How to use radio button correctly in rails?

后端 未结 2 1531
耶瑟儿~
耶瑟儿~ 2020-12-23 20:06

I\'m trying to create some radio buttons and I\'m not sure how to. Following this question I\'ve got it set up working almost correct, but I\'m new to this and not sure why

2条回答
  •  时光说笑
    2020-12-23 20:24

    see label(object_name, method, content_or_options = nil, options = nil, &block)

      
    <%= f.label :autolyse %>
    <%= f.label :autolyse, "Yes", :value => "true" %> <%= f.radio_button :autolyse, true %> <%= f.label :autolyse, "No", :value => "false" %> <%= f.radio_button :autolyse, false, :checked => true %>

提交回复
热议问题