[Rails] Re: inserting multiple rows
mizage
estettler at mail.com
Wed Dec 14 17:36:42 GMT 2005
the table is about that except for the id column (which auto increments)
and name.
> picks (tablename)
> ---------------
id (column
pick_id (column)
user_id (column)
game_id (column)
There is one pick per game_id. So now the html is:
<input type="hidden" id="pick.game_id" name="pick[game_id]" value="1">
<input type="hidden" id="pick.user_id" name="pick[user_id]" value="5">
<select id="pick_pick" name="pick[pick]">
...
</select
<input type="hidden" id="pick.game_id" name="pick[game_id]" value="2">
<input type="hidden" id="pick.user_id" name="pick[user_id]" value="5">
<select id="pick_pick" name="pick[pick]">
...
</select
...plus another 40 fields which
the controller now does this:
pick = Pick.new(params['pick'])
pick.save
The first group of fields is saved to the db correctly. The other
41 do not get saved. Do I need to loop in my controller?
cheers, etienne
--
Posted via http://www.ruby-forum.com/.
More information about the Rails
mailing list