How to get blank checkboxes to pass as false to params

You need to place a hidden field tag before each checkbox with an empty value, for example:

<%= hidden_field_tag :basketball, '' %>
<%= check_box_tag :basketball, checked = true %> Basketball</br></br>

Then the form is aware it needs to populate that field with an empty value if nothing is selected.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)