Hello, I have an order form on my site where people can enter in the number of products they want to buy. Once they have filled out the quantities and press continue the form values look like this: Parameters: {"commit"=>"Continue", "order_form"=>{"127"=>"3", "128"=>"1", "129"=>"0", "130"=>"0", "136"=>"0", "137"=>"0", "126"=>"2"}} The first number in the "number pairs" is the ID of the product and the second is the quantity they entered. How can I loop over the "order_form" array a get both the first and second value? Any help appreciated! -- 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 -~----------~----~----~----~------~----~------~--~---
On 10/4/06, Scott Harvey <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hello, > > I have an order form on my site where people can enter in the number of > products they want to buy. Once they have filled out the quantities and > press continue the form values look like this: > > Parameters: {"commit"=>"Continue", "order_form"=>{"127"=>"3", > "128"=>"1", "129"=>"0", "130"=>"0", "136"=>"0", "137"=>"0", "126"=>"2"}} > > The first number in the "number pairs" is the ID of the product and the > second is the quantity they entered. > > How can I loop over the "order_form" array a get both the first and > second value?params[:order_form].each do |key,value| end --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks, that is exactly what I was looking for. I just couldn''t find the answer anywhere. -- 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 -~----------~----~----~----~------~----~------~--~---