【发布时间】:2013-02-21 00:17:40
【问题描述】:
我正在尝试使用单选按钮的集合 (?) 填充表单:
# _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,因为表单已显示但没有保存保存到数据库。
有人可以帮忙吗?
谢谢...
【问题讨论】:
-
请检查您的参数以获得更好的想法。
标签: ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-3.2 radio-button