aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorDalibor Nasevic <dalibor.nasevic@gmail.com>2011-03-06 23:54:18 +0100
committerDalibor Nasevic <dalibor.nasevic@gmail.com>2011-03-06 23:54:18 +0100
commit55d2a211d374b7e8102a72bcd1313ef4b097ba73 (patch)
tree705762f597f8be44c01fb6de4ff6af73c8155995 /activesupport/lib/active_support
parent8e0affbd861369d84273a4f89917fda24157ead4 (diff)
downloadrails-55d2a211d374b7e8102a72bcd1313ef4b097ba73.tar.gz
rails-55d2a211d374b7e8102a72bcd1313ef4b097ba73.tar.bz2
rails-55d2a211d374b7e8102a72bcd1313ef4b097ba73.zip
Improved docs for Hash#to_param method
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/core_ext/object/to_param.rb5
1 files changed, 2 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 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 <tt>namespace</tt> 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 <tt>to_query</tt>.
#
# ==== 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)