:select, :collection => -6ren">
gpt4 book ai didi

ruby-on-rails - 具有 HBTM 关联的 ActiveAdmin 自定义过滤器

转载 作者:行者123 更新时间:2023-12-04 03:46:43 24 4
gpt4 key购买 nike

我希望能够过滤具有这种关联的对象

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>

最佳答案

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

关于ruby-on-rails - 具有 HBTM 关联的 ActiveAdmin 自定义过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9790592/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com