From ae8c384e2c07da4870dd3919321a6d49aeff3588 Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Thu, 18 Feb 2010 16:29:32 -0800 Subject: Avoid calling triggering const_missing if const_missing is private when doing constantize --- activesupport/lib/active_support/inflector/methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/inflector') diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb index 41277893e3..c7df62e915 100644 --- a/activesupport/lib/active_support/inflector/methods.rb +++ b/activesupport/lib/active_support/inflector/methods.rb @@ -109,7 +109,7 @@ module ActiveSupport constant = Object names.each do |name| - constant = constant.const_get(name, false) || constant.const_missing(name) + constant = constant.const_defined?(name, false) ? constant.const_get(name) : constant.const_missing(name) end constant end -- cgit v1.2.3 From 67512b9489593ddcd1c0c87ba0052380355b5400 Mon Sep 17 00:00:00 2001 From: Stijn Mathysen Date: Fri, 5 Mar 2010 08:04:25 +0100 Subject: Removed the + sign as an accepted character from the parameterize method, as a + sign is interpreted by the browser as a space, possibly resulting in a "ArgumentError: illegal character in key" [#4080 state:committed] Signed-off-by: Jeremy Kemper --- activesupport/lib/active_support/inflector/transliterate.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib/active_support/inflector') diff --git a/activesupport/lib/active_support/inflector/transliterate.rb b/activesupport/lib/active_support/inflector/transliterate.rb index 30a9072ee1..236f2eb628 100644 --- a/activesupport/lib/active_support/inflector/transliterate.rb +++ b/activesupport/lib/active_support/inflector/transliterate.rb @@ -47,7 +47,7 @@ module ActiveSupport # replace accented chars with their ascii equivalents parameterized_string = transliterate(string) # Turn unwanted chars into the separator - parameterized_string.gsub!(/[^a-z0-9\-_\+]+/i, sep) + parameterized_string.gsub!(/[^a-z0-9\-_]+/i, sep) unless sep.nil? || sep.empty? re_sep = Regexp.escape(sep) # No more than one of the separator in a row. -- cgit v1.2.3