aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/object/to_param.rb
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-11-16 19:57:09 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2010-11-18 23:31:00 -0200
commit52b71c01fd3c8a87152f55129a8cb3234190734a (patch)
treecb5bae029d05960767990919ffc95cda003f3b68 /activesupport/lib/active_support/core_ext/object/to_param.rb
parent07a74f196d6766c09e28ed696debb120a035dde7 (diff)
downloadrails-52b71c01fd3c8a87152f55129a8cb3234190734a.tar.gz
rails-52b71c01fd3c8a87152f55129a8cb3234190734a.tar.bz2
rails-52b71c01fd3c8a87152f55129a8cb3234190734a.zip
Revert "Quick fix for not escaping []s (not ideal)"
According to http://www.ietf.org/rfc/rfc2616.txt and http://tools.ietf.org/rfc/rfc3986.txt [ and ] are reserved characters and should be escaped using "%" HEX HEX This reverts commit 856d2fd874d72dd9f83204affff4edfef3308361 and 1ee9b40b18a0bed5bb10a0785f7e2730bac983f6..
Diffstat (limited to 'activesupport/lib/active_support/core_ext/object/to_param.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/object/to_param.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/to_param.rb b/activesupport/lib/active_support/core_ext/object/to_param.rb
index ecb2bca82c..593f376159 100644
--- a/activesupport/lib/active_support/core_ext/object/to_param.rb
+++ b/activesupport/lib/active_support/core_ext/object/to_param.rb
@@ -1,5 +1,3 @@
-
-
class Object
# Alias of <tt>to_s</tt>.
def to_param
@@ -41,7 +39,7 @@ class Hash
# ==== Examples
# { :name => 'David', :nationality => 'Danish' }.to_param # => "name=David&nationality=Danish"
#
- # { :name => 'David', :nationality => 'Danish' }.to_param('user') # => "user[name]=David&user[nationality]=Danish"
+ # { :name => 'David', :nationality => 'Danish' }.to_query('user') # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish"
def to_param(namespace = nil)
collect do |key, value|
value.to_query(namespace ? "#{namespace}[#{key}]" : key)