簡體   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