I have a search form with many options, sent to a route with a Get request. The url looks something like this:
http://localhost:3000/restaurants/search?utf8=%E2%9C%93&city=&cuisine=&number_of_people=&query=hello
with a lot of options. I want to make cleaner something like deleting all the parameters that are empty.
something like this: (Basically removing all parameters that are empty)
http:
How to do it?
One way can be used
CGI::parse("foo=bar&bar=foo&hello=hi")
Gives you
{"foo"=>["bar"], "hello"=>["hi"], "bar"=>["foo"]}
First, redirect the user to an action between actions and that between actions they check which parameters are empty and delete them, and then, finally, redirect them to the actual search action. But that sounds very weak. How can I do it better?
Mohit jain
source share