sacshu
sacshu

Reputation: 407

Having an issue with check_box and boolean attribute

I'm using a checkbox in the edit action, and when I go into the form and "check" the box, everything works fine. But then when I go back and try to "uncheck the box" it doesn't seem to save.

Here's my code for the form:

<%= f.label :winning, "Did this Proposal Win?", class: "input-title" %>
<%= f.check_box :winning, {}, true, false %>

Upvotes: 0

Views: 550

Answers (1)

Maciej Litwiniuk
Maciej Litwiniuk

Reputation: 419

Why are you providing this set of extra parameters? Do just this:

<%= f.check_box :winning %>

Eventually - try to use 1 and 0, not true and false.

Upvotes: 2

Related Questions