Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails checkbox and params

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?

like image 524
Arthur Wilson Avatar asked Oct 23 '11 23:10

Arthur Wilson


1 Answers

You'll already get only the ones that were checked; unchecked boxes aren't sent to the server.

like image 149
Dave Newton Avatar answered Nov 14 '22 17:11

Dave Newton