[Rails] add an array to params
Hello everybody,
I hope you can help me in this problem.
I need to add an array to params in order to send some data from the
view to the controller.
I'm using JavaScript to dynamically add lines lihe this:
<li>
<input type="text" value="...">
<input type="text" value="...">
<input type="checkbox" checked="checked" value="...">
</li>
Then, after the submit I need to access to the the values in this way:
params[:items].each do |i|
logger.debug("--> #{i[:desc]} ");
logger.debug("--> #{i[:value]} ");
logger.debug("--> #{i[:flag]} ");
end
So, I think the proper way is to add te "name" field in this way:
<input type="text" name="items[0][desc]"nvalue="...">
But there is something wrong.
Does someone can help me?
--
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@googlegroups.com.
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home