Hi,
I have a Shops controller where I am getting params of shop as a hash. The
params format is
* {"key1"=>"business",
"value1"=>"shoes", "key2"=>"date",
"value2"=>"2014", "key3"=>"price",
"value3"=>"3000"}*
In routes file I have written as
* match
'/shops/:shop_id/new/:key1/:value1/:key2/:value2/:key3/:value3',
:to => 'shops#new'*
So in the browser I will type as
* localhost:3000/shops/3/new/business/shoes/date/2014/price/3000*
The order of params will not be of same order sometimes. So in the url it
can be like
* localhost:3000/shops/3/new/business/shoes/price/3000/date/2014*
so that it should retrive corresponding params and assign the values.
So I need to check the corresponding keys and assign values accordingly.
That means for eg:
* If params[:key] contains business then value should be assigned as
"shoes", if params[:key] is date, then value should be assigned to
"2014".etc*
How can I achieve it. Please help.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/28498493-1337-4c04-8249-f4ad1837256c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.