:something => {:foo => 1, :bar => 2} in a GET request

Hi, it seems that there is a bug in RoR 1.2.3

url_for(:controller => ‘cont’, :action => ‘edit’, :id => 10, :something
=> {:foo => 1, :bar => 2})
produces a wrong result
/cont/edit/10?something=a1b2

instead of
/cont/edit/10?something[a]=1&something[b]=2

I absolutely need to pass an hash during a GET request - How can I do ?

Thanks

My guess is that this is not supported as I have never seen that
used. You can submit the data using a form, or flatten the entries
and rebuild the hash on the server.

Michael

MichaelLatta wrote:

My guess is that this is not supported as I have never seen that
used. You can submit the data using a form, or flatten the entries
and rebuild the hash on the server.

Seems there is a real bug, corrected in edge version :
http://darwinweb.net/article/Nested_Hashes_In_Url_For_Parameters

In fact, playing with the URL directly with foo[a]=1&foo[b]=2 does
correctly put a hash :foo{:a =>1, :b => 2} in params

I can’t use a POST form request because I need to make a distinction
between GET and POST requests.

How would you flatten the entries ?

Cheers

This has been fixed for Rails 2.0. I also needed this to work, so I
tried backporting the changes, but it’s pretty tricky. So I just
created a work-around function. You can get it on my blog at
http://darwinweb.net/article/Nested_Hashes_In_Url_For_Parameters