我的指南模型有一个国家属性。我不想使用插件,我只想将国家作为字符串。一切正常,直到我尝试在 activeadmin 中编辑指南,然后收到错误消息:
ActionView::Template::Error (To use the :country input, please install a country_select plugin, like this one: https://github.com/jamesds/country-select): 1: insert_tag renderer_for(:edit)
在我的形式我有
<%= f.input :country, as: :string%>
在我的 admin/guidelines.rb 我有
index do
column :title
column :specialty
column :content
column :hospital
column :country
column :user
default_actions
end
最佳答案
我不确定您从何处获取此表单代码,但我在使用 Active Admin 时遇到了同样的问题,并通过明确指示表单将该字段视为字符串来解决该问题:
ActiveAdmin.register Guideline do
form do |f|
f.inputs 'Details' do
f.input :country, :as => :string
end
f.actions
end
end
关于ruby-on-rails - 要使用 :country input, 请安装 country_select 插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15536606/