laredotornado-8iDLEspWrrZBDgjK7y7TUQ@public.gmane.org
2008-Jan-18 20:17 UTC
creating multiple objects on the same page
Hi, I want to have a very simple ordering page where users type in what they want. They have a maximum of ten items to enter and must enter at least one. The item table has these columns: id integer unsigned auto_increment, order_number integer unsigned item_number integer unsigned, description text My question is, what is the proper naming procedure on the ordering view page for each of the ten items so that the controller may most easily store the items? What is the corresponding code that I should put in the controller? Thanks, - Dave --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
sounds like the naming convention you would want would be something like object[attribute][] ie. <input name="item[description][]" /> -- 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 -~----------~----~----~----~------~----~------~--~---
laredotornado-8iDLEspWrrZBDgjK7y7TUQ@public.gmane.org
2008-Jan-21 18:17 UTC
Re: creating multiple objects on the same page
Thanks but what if I have 10 of that same item on the page. Would I then change my convention to: <input name="item1[description][]" /> <input name="item2[description][]" /> and if so, how would I process that on the controller end? - Dave On Jan 18, 6:36 pm, Keynan Pratt <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> sounds like the naming convention you would want would be something like > > object[attribute][] > > ie. > > <input name="item[description][]" /> > > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---