Reputation: 467
I want a radio button with 2 value. It's default value is set as false. Currently, the data is not saved into the database. I have scoured SO and look at ruby's form_helper docs and still can't seem to find out what's wrong with my code.
This code is supposed to be in index.html.erb
<div>
<%= form.label :is_done, "Done", :value => true %>
<%= form.radio_button :is_done, true %>
</div>
<br>
I have also tried this method
<div>
<%= form.radio_button :is_done, true %>
<%= form.label :is_done, "True", :value => true %>
<%= form.radio_button :is_done, false %>
<%= form.label :is_done, "False", :value => false %>
</div>
Edit: both versions are working perfectly, some random undo and redo fixed something
Upvotes: 0
Views: 119