aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorHincu Petru <hincupetru@gmail.com>2014-02-03 09:51:05 +0000
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-02-05 23:31:50 -0200
commit326e6527497126b2ea3627e377b6a4b5c9191bef (patch)
tree8d13260b7ad28b511a6f5b0ec02c945497033416 /activesupport/lib
parent6cc3afb00a0d7689f5435a3845fd17266d935c3e (diff)
downloadrails-326e6527497126b2ea3627e377b6a4b5c9191bef.tar.gz
rails-326e6527497126b2ea3627e377b6a4b5c9191bef.tar.bz2
rails-326e6527497126b2ea3627e377b6a4b5c9191bef.zip
Fixed "Hash#to_param confused by empty hash values #13892"
Diffstat (limited to 'activesupport/lib')
-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! * '&'