check_box_tag and params hash
I have some checkboxes like so in a form:
<%= check_box_tag "marked[#开发者_运维百科{relative_filepath}]", 1, false %>
Which produces:
<input type="checkbox" value="1" style="display: none;" name="marked[/blah]" id="marked__blah">
Now supposedly, I should there should be a hash in params[:marked], but this is nil.
What am I doing wrong?
From railsapi.com
:
"The HTML specification says unchecked check boxes are not successful, and thus web browsers do not send them."
I usually use something like params[:object][:method].to_bool
.
精彩评论