开发者

check_box_tag and params hash

开发者 https://www.devze.com 2023-01-05 07:10 出处:网络
I have some checkboxes like so in a form: <%= check_box_tag \"marked[#开发者_运维百科{relative_filepath}]\", 1, false %>

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消