我試圖簡單地允許篩選ActiveAdmin的位置頁面上的類別。通過Active Admin設置has_many通過篩選器
我有三個型號:
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,但什麼都不會有效。
有沒有人經歷過這種 - 任何人都有解決方案?
上午有同樣的問題,我無法從移動HABTM通過對HAS_MANY /,所以任何真正的解決這個? –