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

时间:2014-05-09 08:58:51

标签: ruby-on-rails activeadmin

如果在我的模特中我有这样的关系: 模特学位:

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

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

1 个答案:

答案 0 :(得分:0)

你是否在degrees.rb中尝试过类似的东西:

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