Ruby on rails 带提示的Formtastic电台收藏
我正在与积极的管理,以创建一个表单,其中有一个电台收集Ruby on rails 带提示的Formtastic电台收藏,ruby-on-rails,ruby,activeadmin,formtastic,Ruby On Rails,Ruby,Activeadmin,Formtastic,我正在与积极的管理,以创建一个表单,其中有一个电台收集 form do |f| f.inputs "Options" do f.input :type, as: :radio, collection: Types.all.map{|type| [type.name, type.name]} end end 我想为radio集合中的每个选项添加一个提示。(类似于字符串输入或各种其他输入的提示) 最好的方法是什么?我会这样做: f.input :type, as: :radio,
form do |f|
f.inputs "Options" do
f.input :type, as: :radio, collection: Types.all.map{|type| [type.name, type.name]}
end
end
我想为radio集合中的每个选项添加一个提示。(类似于字符串输入或各种其他输入的提示)
最好的方法是什么?我会这样做:
f.input :type, as: :radio, collection: Type.pluck(:name)
方法pluck
与执行Type.all.map(&:name)
有关更多信息,请参阅 这个答案无助于解决如何在每个选项中显示提示的问题