Ruby on Rails -- assign a value to a checkbox
I want to assign a value to a checkbox. The code below doesn't seem to work
Same Section <%= f.check_box 开发者_StackOverflow社区:LSU_TYPE, :value =>"Same Section" %>
Instead of storing 'Same Section' in the table, value '1' is stored when i check the box.
What am i doing wrong here?
A checkbox is a boolean field. It can only accept 1 or 0, 'True' or 'False'.
@Kum this works for me:
<div><%= f.label :pay_with_card? %></br>
<%= f.check_box :pay_with_card,{}, "Yes", "No"%>
good luck!
精彩评论