misnomer-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Feb-12 14:18 UTC
Creating multiple records in one form
I want to have a form with which the user can choose options (meal choices) for themselves and a number of ''dinner companions''. The number is pre-specified in a different form. I have an attendee model, and a ''diner'' model which has an attendee_id field, and a ''diner_number'' field - so if the attendee wants to have 2 companions the diner id''s would be 0 for the attendee themselves, and 1, 2 for the companions. I wanted to do this so that there was no way to submit choices for anyone elses dinner. The problem is, I''m not sure how to get this working properly - I have it set up to make a number of entry options in the form, each with the index set to 0, 1, 2...., but it''s how to a) make these work with newly created objects, so that they have the correct defaults upon form creation, and secondly how to process this data in the controller upon submission - and have validation working properly. Does this make sense, and any thoughts? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---