Hello, I have a form which contains a table that users fill in. The table data will not be going into the form''s own object, but into a series of objects (one per row) via a has_man :through relationship. I can''t figure out how to supply field names to the form helper methods so that the proper params sub-hashes will be built. I''m currently building the form fields manually, and this is what they look like: <input id="inclusion_1_fee" name="inclusion[1][fee]" size="4" type="text"/> <input id="inclusion_2_fee" name="inclusion[2][fee]" size="4" type="text"/> <input id="inclusion_3_fee" name="inclusion[3][fee]" size="4" type="text"/> Would someone please tell me how I can generate these input tags using a form helper method? Thanks, Avram -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
To anyone who cares, I found the answer here: http://railsforum.com/viewtopic.php?pid=3714 The short version is that fields_for somehow does this automagically. I don''t really understand how it works, it appears to involve what I consider a trick, whereby you make sure you have an instance variable around who''s name matches the value you supply to fields_for, and then it inserts that object''s .id attribute into the []. I don''t really know, I''m just guessing from looking at the code. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---