From 55d2a211d374b7e8102a72bcd1313ef4b097ba73 Mon Sep 17 00:00:00 2001 From: Dalibor Nasevic Date: Sun, 6 Mar 2011 23:54:18 +0100 Subject: Improved docs for Hash#to_param method --- activesupport/lib/active_support/core_ext/object/to_param.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'activesupport/lib/active_support/core_ext/object') 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 593f376159..5e0ad4d1cf 100644 --- a/activesupport/lib/active_support/core_ext/object/to_param.rb +++ b/activesupport/lib/active_support/core_ext/object/to_param.rb @@ -34,12 +34,11 @@ end class Hash # Converts a hash into a string suitable for use as a URL query string. An optional namespace can be # passed to enclose the param names (see example below). The string pairs "key=value" that conform the query - # string are sorted lexicographically in ascending order. + # string are sorted lexicographically in ascending order. This method is also aliased as to_query. # # ==== Examples # { :name => 'David', :nationality => 'Danish' }.to_param # => "name=David&nationality=Danish" - # - # { :name => 'David', :nationality => 'Danish' }.to_query('user') # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish" + # { :name => 'David', :nationality => 'Danish' }.to_param('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) -- cgit v1.2.3