繁体   English   中英

如果我有关系,如何在active_admin中更改过滤器

[英]how to change filter in active_admin if i have relation

如果在我的模型中我有这样的关系:模型度:

class Degree < ActiveRecord::Base
  has_and_belongs_to_many :states
  accepts_nested_attributes_for :states, :allow_destroy => true
end

模型状态:

class State < ActiveRecord::Base
  has_and_belongs_to_many :degrees  
  accepts_nested_attributes_for :degrees, :allow_destroy => true
end

如果我有上述关系,如何在索引度活动管理员中覆盖状态过滤器?

您是否在degree.rb中尝试过类似的方法:

ActiveAdmin.register Degree do
  ...
  filter :states_id, :as => :check_boxes, :collection => proc {State.all}
  ...
end

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM