Hi,
I was pleased to see how easy it is to add more then one new items in a form:
form_tag :action => 'update_multiple' do 3.times do @item = Item.new # create an active record object text_field 'item', 'name' end end
the action "update_multiple" now gets a list of the three items (params[:item]). Wonderful.
It even works for already known items / items from the database:
form_tag :action => 'update_multiple' do @item = Item.find(1) text_field 'item', 'name'
@item = Item.find(2) text_field 'item', 'name'
@item = Item.find(3) text_field 'item', 'name' end
Here also "update_multiple" gets the list...
...but I would not post here if I don't have a problem.
If I mix both using some new und some known items than I get an server error:
form_tag :action => 'update_multiple' do # show some "old" items @item = Item.find(1) text_field 'item', 'name'
@item = Item.find(2) text_field 'item', 'name'
# add three new items 3.times do @item = Item.new # create an active record object, which doesn't have an id yet text_field 'item', 'name' end end
this leads to the error 500-message. When I look into the log file the following entry comes up: