Issue updating multiple database rows from single form submi

So I’ve got a form that loops through items with a text_field_tag and
text_area_tag that lists items in the database to be edited.

I want to submit this form and have it loop through the items and update
the rows based on the ids in the name attribute of the input tag.

The names are formatted like photos[1234][description].

Here’s what I’ve got so far but i’m not sure really how to get it
functioning correctly in the controller: (and note, I’m not sold on
going about this the following way…it’s just what I’ve got thus far.


<% form_for :photo, :url => { :action => “update_complete” } do |form|
<% for photo in @photos %>
<%= text_field_tag “photos[#{}][filename]”, photo.filename
<%= text_area_tag “photos[#{}][description]”,
photo.description %>
<% end %>
<% end %>


def update_complete
params[:photos].each do |id|
@photo = Photo.find(id)