要使用:country输入,请安装country_select插件

tes*_*sad 7 forms ruby-on-rails ruby-on-rails-3 activeadmin

我的指南模型有一个国家/地区属性.我不想使用插件,我只想将国家作为字符串.一切正常,直到我尝试在activeadmin中编辑指南,然后我收到错误消息:

ActionView :: Template :: Error(要使用:country输入,请安装country_select插件,如下所示:https: //github.com/jamesds/country-select):1:insert_tag renderer_for(:edit)

以我的形式,我有

 <%= f.input :country, as: :string%>
Run Code Online (Sandbox Code Playgroud)

在我的admin/guidelines.rb中我有

index do                            
    column :title   
    column :specialty                
    column :content       
    column :hospital
    column :country   
    column :user
    default_actions                   
  end
Run Code Online (Sandbox Code Playgroud)

Mic*_*sel 16

我不确定从哪里获得此表单代码,但我遇到与Active Admin相同的问题,并通过明确指示表单将字段视为字符串来解决它:

ActiveAdmin.register Guideline do

  form do |f|
    f.inputs 'Details' do
      f.input :country, :as => :string
    end
    f.actions
  end

end
Run Code Online (Sandbox Code Playgroud)


pix*_*rth -1

我想你可以安装 gem,然后覆盖 active_admin 中的显示。