我有:
- [ 'here now', 'trip scheduled', 'planning a trip', 'already visited' ].each do |travel|
%div.field.radio.small.snug.bind
= f.radio_button :expected_travel, travel
= label_tag "visitors_guide_request_expected_travel[#{travel}]", travel.titleize
我需要默认选中为“现在这里”生成的单选按钮。最简单的方法是什么?
答案 0 :(得分:1)
您可以将:checked
选项传递到radio_button:
= f.radio_button :expected_travel, travel, :checked => travel == 'here now'
这将检查值为here now