Hi all, I''m trying to track down the source of the to_param method for hashes. let''s say I have a hash like this: {:b=>"This is a description", :a=>"1"} what I currently get from to_param is "a=1&b=This+is+a+description" which is both sorted and escaped. The problem is I need the values to be URI escaped (a space should be %20, not a +) and I can''t figure out an easy way to do it. I also can''t track down the actual source (for example, how does the sorting takes place?) can someone help out? 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2009-Mar-05 17:23 UTC
Re: help me understand what to_param does on a hash
On 5 Mar 2009, at 16:47, Ehud Rosenberg wrote:> > Hi all, > I''m trying to track down the source of the to_param method for hashes. > let''s say I have a hash like this: {:b=>"This is a description", > :a=>"1"} > what I currently get from to_param is "a=1&b=This+is+a+description" > which is both sorted and escaped. > The problem is I need the values to be URI escaped (a space should be > %20, not a +) and I can''t figure out an easy way to do it. I also > can''tCGI::escape disagrees> track down the actual source (for example, how does the sorting takes > place?)It''s in active_support/core_ext/hash/conversions.rb Fred> > > can someone help out? > 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 -~----------~----~----~----~------~----~------~--~---