[英]Preserving input filter activeadmin
I am trying to keep my inputs in my filter in activeadmin here my code: 我试图在我的代码中将我的输入保存在activeadmin的过滤器中:
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. 我不确定你需要什么,但是由于这个问题,我认为在使用ActiveAdmin时它会自动为每个模型属性创建一个过滤器,但是如果你添加一个自定义过滤器 ,它们都会被带走。
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. 如果这是你的问题,请告诉我。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.