ruby - Checkboxes in rails returning no value? How to get Checkboxes working with Rails -


i trying values check boxes, whenever use params[:chosen], seems return nil. missing? params right way it?

this line have in view:

<td><%= check_box_tag "chosen[#{i}]",i,true,:name => "chosen[]" %></td> 

this produce checkboxes can never seem value it. need put in controller?

thank you

i don't think need :name => "chosen[]". first argument used name. also, rails guides recommend using label_tag wtih check_box_tag

<td> <%= label_tag :my_attribute, "attribute label" %> <%= check_box_tag :my_attribute, my_model.my_attribute %> </td> 

then controller can check params[:my_attribute]


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -