aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-03-07 22:11:47 +0100
committerXavier Noria <fxn@hashref.com>2011-03-07 22:11:47 +0100
commit89ecc0a5dc1d06a6bbd2a59edd57187c6eedf8af (patch)
tree762f7860f65b7e058016707ef6771b1ff2feb7cb /activesupport/lib/active_support/core_ext
parent5968d7a65886d3450698889f685eccaf54749f43 (diff)
parentf99db5a6a8295b463325accaefe53ab6c89c9982 (diff)
downloadrails-89ecc0a5dc1d06a6bbd2a59edd57187c6eedf8af.tar.gz
rails-89ecc0a5dc1d06a6bbd2a59edd57187c6eedf8af.tar.bz2
rails-89ecc0a5dc1d06a6bbd2a59edd57187c6eedf8af.zip
Merge branch 'master' of git://github.com/lifo/docrails
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r--activesupport/lib/active_support/core_ext/array/random_access.rb4
-rw-r--r--activesupport/lib/active_support/core_ext/object/to_param.rb5
2 files changed, 4 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/random_access.rb b/activesupport/lib/active_support/core_ext/array/random_access.rb
index 9a6b5e9b79..ab1fa7cd5b 100644
--- a/activesupport/lib/active_support/core_ext/array/random_access.rb
+++ b/activesupport/lib/active_support/core_ext/array/random_access.rb
@@ -1,5 +1,5 @@
class Array
- # Backport of Array#sample based on Marc-Andre Lafortune's http://github.com/marcandre/backports/
+ # Backport of Array#sample based on Marc-Andre Lafortune's https://github.com/marcandre/backports/
# Returns a random element or +n+ random elements from the array.
# If the array is empty and +n+ is nil, returns <tt>nil</tt>. if +n+ is passed, returns <tt>[]</tt>.
#
@@ -24,4 +24,4 @@ class Array
result[n..size] = []
result
end unless method_defined? :sample
-end \ No newline at end of file
+end
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)