Ruby on Rails 4.2.1 In a view I'm making checkboxes like this:
<%= check_box_tag('roles[' + role.name + '][' + perm.name + ']', 1, {checked: role.permissions.include?(perm)}) %>
But this renders a checked checkbox every time, even when role.permissions.include?(perm)
returns false
I've put debugger
in the view and double checked this. inside the view when I put into the debug console this:
check_box_tag('test', 1, {checked: false})
Out comes this:
"<input type=\"checkbox\" name=\"test\" id=\"test\" value=\"1\" checked=\"checked\" />"
Is this a bug in Rails form helpers or am I missing something?