Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Active admin customize filter only specific attribute

I have active admin integrated to my app. In Users section the filter is having too many attributes and if I have to customize one the condition in the filter I have to re-write the entire filter again. Can someone suggest me a way to modify a specific condition of the filter than rewriting the entire filter. I want to modify condition for Names list from the attachment.

Like here I have to re-write all the conditions for the filter, instead I want to update a specific filter condition

 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]}} 

Filter with conditions

like image 993
Bhaskara Rao Avatar asked Oct 30 '25 19:10

Bhaskara Rao


1 Answers

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] } }
like image 183
Timo Schilling Avatar answered Nov 02 '25 18:11

Timo Schilling



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!