【问题标题】:Formtastic select boxes, radio buttons, etc. are not workingFormtastic 选择框、单选按钮等不起作用
【发布时间】:2011-12-20 18:52:46
【问题描述】:

我目前安装了 active_admin(也使用了 formtastic),当然也安装了 formtastic 本身。

请看下面的代码:

<%= f.inputs :hero_id, :as => :select, :collection => Hero.find(:all) %> 
<%= f.inputs :name %> 
<%= f.inputs :starting_items, :as => :select, :collection => Item.find(:all) %> 
<%= f.inputs :early_items, :as => :select, :collection => Item.find(:all) %> 
<%= f.inputs :core_items, :as => :select, :collection => Item.find(:all) %> 
<%= f.inputs :situational_items, :as => :select, :collection => Item.find(:all) %>  

<%= f.buttons %>

这个完全相同的代码在 active_admin 中显示填充了数据的选择框。
但是,在我的网站本身上,它只会显示 text_fields,没有任何选择框!

有人知道这里可能是什么问题吗? 因为我的网站上有其他几种表格,如果我能让它正常工作,我可以修复。所有的表单都只是显示 text_fields 而不是选择框、单选按钮、复选框等。

【问题讨论】:

    标签: ruby-on-rails formtastic


    【解决方案1】:

    您应该使用f.input 而不是f.inputs

    【讨论】:

      猜你喜欢
      • 2014-01-31
      • 2017-02-08
      • 1970-01-01
      • 1970-01-01
      • 2015-03-09
      • 2020-10-07
      • 2017-11-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多