The title pretty much says it all. It'd be nice to have the possibility of adding a "Clear" button next to each search field that would (a) clear what the user had written in that field, and (b) immediately perform a new search with the changed parameters, that is, subtracting the filtering previously done by the cleared search parameter.
In the same vein, you could have a "Clear all fields" button, to be placed below the search fields, along with the "Search" button. Pressing this button would clear all search fields (surprise!), and perform a new "search" with the changed (empty) parameters -- that is, all the rows of the search space would be shown.
This sounds like something that you could implement with a bit of JavaScript inside your application. I don't think it's something that Ransack should inherently support itself.
OK. A nice gem, anyway.
It's very easy to add a cancel search link in your page, such as:
<%= link_to "Clear Search", request.path, class:"cancel-button" %>
@mattconnolly Ha, funny how I'll forget simple tricks like this. Beautiful
<%= link_to "Clear Search", request.path, class:"cancel-button" %> after using Clear Search it will redirecting to main search not staying on current search page can you please give me a sol for that.
Most helpful comment
It's very easy to add a cancel search link in your page, such as:
<%= link_to "Clear Search", request.path, class:"cancel-button" %>