This wasn't obvious. Thanks to satish on rails I learned this is the way to do it:
<input type="checkbox" name="customer[preferences][]" value="yellow"/> <input type="checkbox" name="customer[preferences][]" value="blue"/> etc
The extra [] at the end of the parameter name makes all the difference. In your controller, you can now reference
params[:customer][:preferences]
and get a list.
Thank you very much, this really helped me. Nice trick!
ReplyDeleteThis was very helpful. Thnx
ReplyDeleteVery helpful! Thanks, I was wondering how to pass multiple values to the controller. But In my case I didn't need to use a matrix, just an array did the trick.
ReplyDeleteThanks!!!
ReplyDeleteThanks ! Works perfectly ! :D
ReplyDelete