I'm trying to just enable category filtering on the Locations page for ActiveAdmin.
I have three models:
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
On my locations page, I use this filter:
ActiveAdmin.register Location do
filter :name
filter :category, :collection => proc { Category.all }, :as => :select
However, he continues to throw an error.
undefined method `category_eq' for #<MetaSearch::Searches::Location:0x007fd4f9b965d8>
I tried filter: categories, filter: categories_locations, but nothing works.
Has anyone experienced this - does anyone have a solution?
source
share