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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
MichaelLatta
2007-May-21 15:25 UTC
Re: :something => {:foo => 1, :bar => 2} in a GET request
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 nuno wrote:> 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 > > -- > Posted via http://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 On May 21, 7:09 am, nuno <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> 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 > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---