要使用:country输入,请安装country_select插件 [英] To use the :country input, please install a country_select plugin

查看:87
本文介绍了要使用:country输入,请安装country_select插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a country attribute to my guidelines model. I don't want to use a plugin, I just want to have country as a string. Everything is working until I try to edit a guideline in activeadmin and then I get the error message:


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

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文件中,我有

in my admin/guidelines.rb I have

index do                            
    column :title   
    column :specialty                
    column :content       
    column :hospital
    column :country   
    column :user
    default_actions                   
  end


推荐答案

我不确定您从何处获得此表单代码,但我在Active Admin中遇到了同样的问题,并通过明确指示表单将该字段视为字符串来解决了该问题:

I'm not sure where you get this form code from but I had the same issue with Active Admin and resolved it by explicitly instructing the form to treat the field as a string:

ActiveAdmin.register Guideline do

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

end

这篇关于要使用:country输入,请安装country_select插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆