I am working on inviting new users. In the UI am using J query to add text boxes to allow the user to enter many names and corresponding email-ids. On submit I just want to access all the name and emails( multiple values) in my controller. Now I just need a help. Is there a way to create a hash of values with corresponding name and eamil some what like this. {“name1” => “eamil1″,”name2” => “eamil2” } …
Pls help me out in this.
You can use ‘fields_for’ tag and pass a name followed by [] and a form built as shown below will send an array of hash values.
On submitting the form generated by the above code, the params hash will contain names= [ {“name”=> “…”}, {“name” => “…”}, {“name” => “…”}]