filterrific
filterrific copied to clipboard
reset_filterrific_url() should respect the :as option of the form
If you use:
<%= form_for_filterrific @filterrific, as: :filter do |f| %>
<% end %>
the params prefix will be filter
but the reset_filterrific_url()
uses the default filterrific
one:
?filterrific[reset_filterrific]=true
instead of:
?filter[reset_filterrific]=true
I think that an :as
option in the helper would suffice.
@carlosescri using filterrific
as name for the param is an important convention that has implications through large parts of filterrific. Allowing to override the name would make the code significantly more complex, so I prefer not to do it.
Especially since I can't think of a good reason to change the param name. Why do you want to change it?
Well it's just a personal preference. When I develop I tend to use meaningful parameters or, at least, parameter names that don't make the user think about their meaning.
filterrific sounds good to me as a developer because is a very funny name for a library, but filter is something that my users easily recognize.
If you're not going to do anything then it would be better to enforce the :filterrific
prefix here:
https://github.com/jhund/filterrific/blob/master/lib/filterrific/action_view_extension.rb#L15
I had changed it because I thought I could do it safely.
But don't worry. I think I can live with filterrific :-)
I just meet the same problem, but it is not my preference, but this is real need. I had page with 2 tables which I wanted to service via Filterrific - at the moment I see workarounds:
- to fork repo and add this functionality
- to write own helper which allows to do it
As I see it is possible only with small changes in Filterrific::ActionViewExtension and Filterrific::HasResetFilterrificUrlMixin