我正在尝试使用单选按钮的集合(?)填充表单:
# _fields.html.erb
<%= f.label :invoice_type %><br/>
<%= radio_tags_for_select(f.object.invoice_types) %>
# application_helper.rb
def radio_tags_for_select(types)
types_html = types.map do |type|
content_tag :span, :class => "radio_option" do
radio_button(:invoice_types, type, type) + type
end
end
safe_join(types_html)
end
似乎我无法在这一行中获得正确的语法:radio_button(:invoice_types, type, type) + type
因为表单被显示但没有保存保存到数据库中。
有人可以帮忙吗?
谢谢...