问题
I am using many checkboxes in a page as the following:
<%= check_box_tag(:one, value = 1) %></p>
Imagine that it goes from 1 to 20, all the same with the value changed. How can I get in the controller the params
of the ones that were checked?
Example: If user checks 3, 5 and 10 how can I get just those params in a single params?
回答1:
You'll already get only the ones that were checked; unchecked boxes aren't sent to the server.
来源:https://stackoverflow.com/questions/7870090/rails-checkbox-and-params