ActiveAdminの[場所]ページでカテゴリのフィルタリングを許可しようとしています。
私は3つのモデルを持っています:
class Location < ActiveRecord::Base
has_many :categories_locations
has_many :categories, :through => :categories_locations
class CategoriesLocation < ActiveRecord::Base
belongs_to :category
belongs_to :location
end
class Category < ActiveRecord::Base
has_many :categories_locations
has_many :locations, :through => :categories_locations
end
私の場所のページでは、次のフィルターを使用しています。
ActiveAdmin.register Location do
filter :name
filter :category, :collection => proc { Category.all }, :as => :select
ただし、エラーが発生し続けます。
undefined method `category_eq' for #<MetaSearch::Searches::Location:0x007fd4f9b965d8>
filter:categories、filter:categories_locationsを試しましたが、何も機能しません。
誰かがこれを経験したことがあります-誰かが解決策を持っていますか?