鉴于此模型,
class Flat < ActiveRecord::Base
belongs_to :owner, polymorphic: true
end
在RailsAdmin中,我想添加一个owner_type过滤器。我该怎么办?
答案 0 :(得分:1)
似乎对于所有关联字段,默认情况下都会关闭过滤。您需要做的就是重新打开它。
class Flat < ActiveRecord::Base
belongs_to :owner, polymorphic: true
rails_admin do
list do
filters [:owner_type] # if you'd like an owner_type filter by default
field :owner_type do
filterable true # allow owner_type to be filtered on
end
end
end
end