aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/hash
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-11-01 11:06:47 +0100
committerJeremy Kemper <jeremy@bitsweat.net>2009-11-02 17:50:12 -0800
commitb540eca5889d7a28fac39c9ec0df715aa89487ce (patch)
tree76a8ef40d8a9e99f1dc36a5b526b9a4c9c62567c /activesupport/lib/active_support/core_ext/hash
parent8935854375a6c08acd617beaec30f6fd09a29ea0 (diff)
downloadrails-b540eca5889d7a28fac39c9ec0df715aa89487ce.tar.gz
rails-b540eca5889d7a28fac39c9ec0df715aa89487ce.tar.bz2
rails-b540eca5889d7a28fac39c9ec0df715aa89487ce.zip
Consolidate Object#to_param and #to_query core extensions
Diffstat (limited to 'activesupport/lib/active_support/core_ext/hash')
-rw-r--r--activesupport/lib/active_support/core_ext/hash/conversions.rb17
1 files changed, 0 insertions, 17 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb
index bd9419e1a2..190173f8a0 100644
--- a/activesupport/lib/active_support/core_ext/hash/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb
@@ -1,6 +1,4 @@
require 'active_support/time'
-require 'active_support/core_ext/object/conversions'
-require 'active_support/core_ext/array/conversions'
require 'active_support/core_ext/hash/reverse_merge'
class Hash
@@ -68,21 +66,6 @@ class Hash
)
end
- # 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).
- #
- # ==== Examples
- # { :name => 'David', :nationality => 'Danish' }.to_query # => "name=David&nationality=Danish"
- #
- # { :name => 'David', :nationality => 'Danish' }.to_query('user') # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish"
- def to_query(namespace = nil)
- collect do |key, value|
- value.to_query(namespace ? "#{namespace}[#{key}]" : key)
- end.sort * '&'
- end
-
- alias_method :to_param, :to_query
-
def to_xml(options = {})
require 'builder' unless defined?(Builder)