具有HBTM关联的ActiveAdmin自定义筛选器

时间:2012-03-20 16:12:29

标签: ruby-on-rails ruby-on-rails-3 activeadmin meta-search

我希望能够使用此关联过滤对象

ActiveAdmin.register Vendor do
  filter :"market" , :as => :select, :collection => Market.all
end

Model Market
  has_and_belongs_to_many :vendors
Model Vendor
  has_and_belongs_to_many :associated_markets, :class_name => "Market"

但我收到一个错误:

undefined method `market_eq' for #<MetaSearch::Searches::Vendor:0x007f9f5c02dd18>

1 个答案:

答案 0 :(得分:3)

  filter :associated_markets_id, collection: proc { Market.all }, as: :select