【Rails】active_adminでモデルのカラム名にcountryを使うとエラー
active_adminで管理しているモデルに"country"を含むカラムがあると以下のようなエラーが出ます。
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)
country_selectとかいうプラグインを使えと言われるけど、使いたくない。
下記のように、フォームでcountryカラムの型をstringで指定してやることで解決。
app/admin/item.rb form do |f| f.inputs "アイテム詳細" do f.input :name f.input :price f.input :item_category_id f.input :description f.input :material f.input :country, :as => :string end f.actions end
参考記事
ruby on rails - To use the :country input, please install a country_select plugin - Stack Overflow