jhund / filterrific

Filterrific is a Rails Engine plugin that makes it easy to filter, search, and sort your ActiveRecord lists.
http://filterrific.clearcove.ca
MIT License
912 stars 125 forks source link

How can I add a filter which is allways applied #121

Open ck2000 opened 7 years ago

ck2000 commented 7 years ago

I would like to add a default select statement to my filterrific config.

e.g.

@localities = Locality.where(company_id: @company.id) @filterrific = initialize_filterrific( Locality, params[:filterrific], :select_options => { sorted_by: Locality.options_for_sorted_by, with_city: Locality.distinct.pluck(:city) } ) or return @localities = @filterrific.find().page(params[:page])

Could you please help me?

k4m1113 commented 7 years ago

You should be able to do this in the code for your model using the default_filter_params hash.