简体   繁体   中英

Preserving input filter activeadmin

I am trying to keep my inputs in my filter in activeadmin here my code:

controller do
    before_filter by_resolved_at_in: :index do
      if params[:q][:by_resolved_at_in_gteq].blank?
          params[:q][:by_resolved_at_in_gteq] = params[:q][:by_resolved_at_in_gteq]
    end
end

but this doesnot work. Could you help me please?

I'm not sure what you need, but because of the question I think that when working with ActiveAdmin it automatically creates a filter for each of your model attributes but if you add a custom filter all of them are taken away.

So, If you want to preserve the automatic created ones along with yours, maybe adding this line could solve the problem.

preserve_default_filters!

Let me know if this was your question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM