Hi,
How do I parse these parameters to insert into a table:
Parameters: {"commit"=>"Add Contacts to List",
"contact_list"=>{"contact_id"=>["4",
"5"], "list_id"=>"3"}}
Two records should be created.
One where:
list_id = 3
contact_id = 4
And another where:
list_id = 3
contact_id = 5
Thanks,
David
--
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
-~----------~----~----~----~------~----~------~--~---
snhorne-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-29 14:03 UTC
Re: Insert multiple form values
Just do:
params[:contact_ids].each { |cid| YourModel.create(...) }
Cheers
Starr
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---