On Friday, 18 April 2014 07:23:18 UTC-4, prabhu wrote:
In routes file I have written as
The order of params will not be of same order sometimes. So in the url it
“shoes”, if params[:key] is date, then value should be assigned to
“2014”.etc*
How can I achieve it. Please help.
As Colin indicated, you probably shouldn’t do this - there’s already a
standard way to pass a hash of named parameters to a web endpoint.
If you’re stuck with this weird URI format, this should work:
But seriously, use query parameters if at all possible. Using route
params
like this means that you’re forced to pass exactly three parameters and
means you’re going to be stuck encoding on the client-side into this
format, instead of using the built-in stuff for submitting forms…
–Matt J.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.