aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/object/to_param.rb
diff options
context:
space:
mode:
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.rb1
1 files changed, 1 insertions, 0 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 3b137ce6ae..e40846e7d6 100644
--- a/activesupport/lib/active_support/core_ext/object/to_param.rb
+++ b/activesupport/lib/active_support/core_ext/object/to_param.rb
@@ -51,6 +51,7 @@ class Hash
#
# This method is also aliased as +to_query+.
def to_param(namespace = nil)
+ return (namespace ? nil.to_query(namespace) : '') if empty?
collect do |key, value|
value.to_query(namespace ? "#{namespace}[#{key}]" : key)
end.sort! * '&'