From 326e6527497126b2ea3627e377b6a4b5c9191bef Mon Sep 17 00:00:00 2001 From: Hincu Petru Date: Mon, 3 Feb 2014 09:51:05 +0000 Subject: Fixed "Hash#to_param confused by empty hash values #13892" --- activesupport/lib/active_support/core_ext/object/to_param.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activesupport/lib') 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! * '&' -- cgit v1.2.3