I have created a small form to allow users submit 'opinions'. This can be positive or negative. I got a 'positive' boolean field on the DB. This should be true if positive or false if negative.
=form_for @opinion do |f|
= f.hidden_field :event_id
%p
=f.radio_button(:positive, :checked => (:positive == 1))
=f.label :true, 'Positive'
=f.radio_button(:positive, :checked => (:positive == 0))
=f.label :false, 'Negative'
%p
=f.label 'Body'
=f.text_area :body
=f.submit
However, everything is stored right but the positive field. What am I doing wrong?
This is what I get
Parameters: {"utf8"=>"✓", "authenticity_token"=>"EgFB9zohTA93ClNAQpS0qcsEivSCe1imjDUuw/e/YYA=", "opinion"=>{"event_id"=>"31", "positive"=>"{:checked=>false}", "body"=>"asdasasdasd"}, "commit"=>"Create Opinion", "locale"=>"en"}