Reputation: 2356
I have a filter sidebar that starts with a Rails form_tag
and contains a range slider and a bunch of check_box_tag
.
It posts and filters fine. It even persists on the next page as I render it with the checkbox values.
However, if you refresh the page, or send a link to someone, the filters are lost.
The only way I've seen how to do it is to use redirect_to
and merge the params, but I'd rather not make a second call.
How can I pass all the options as query params?
Upvotes: 1
Views: 1532
Reputation: 2620
As you're not creating anything I would recommend using GET
requests with query string parameters. So the query can be shared with the url.
Url for your example image would be something like:
http://www.yourwebsite.com/?max_price=5
Which gives you a params[:max_price]
in controller.
Upvotes: 1