活动管理员自定义过滤器仅特定属性
Active admin customize filter only specific attribute
我在我的应用程序中集成了活跃的管理员。在用户部分,过滤器的属性太多,如果我必须自定义过滤器中的一个条件,我必须再次重写整个过滤器。有人可以建议我修改过滤器的特定条件而不是重写整个过滤器的方法。我想修改附件中名称列表的条件。
像这里我要重写所有的过滤条件,而不是我想更新一个特定的过滤条件
filter :website_users
filter :identities
filter :names, :collection => proc {(Name.all).map{|c| [c.text, c.id]}}
filter :competitions
filter :suggested_names, :collection => proc {(Name.all).map{|c| [c.text, c.id]}}
preserve_default_filters! # build the default filters
remove_filter :website_users # remove a default filter
filter :names, collection: proc { Name.all.map{ |c| [c.text, c.id] } }
我在我的应用程序中集成了活跃的管理员。在用户部分,过滤器的属性太多,如果我必须自定义过滤器中的一个条件,我必须再次重写整个过滤器。有人可以建议我修改过滤器的特定条件而不是重写整个过滤器的方法。我想修改附件中名称列表的条件。
像这里我要重写所有的过滤条件,而不是我想更新一个特定的过滤条件
filter :website_users
filter :identities
filter :names, :collection => proc {(Name.all).map{|c| [c.text, c.id]}}
filter :competitions
filter :suggested_names, :collection => proc {(Name.all).map{|c| [c.text, c.id]}}
preserve_default_filters! # build the default filters
remove_filter :website_users # remove a default filter
filter :names, collection: proc { Name.all.map{ |c| [c.text, c.id] } }