开发者

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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜