aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorAlex Tambellini <atambellini@gmail.com>2012-01-26 14:19:49 -0500
committerAlex Tambellini <atambellini@gmail.com>2012-01-26 14:19:49 -0500
commit7598284c0bd9de93d9bfec4607a64953be1e30f8 (patch)
treeb009bdea1043640b633c9d7c6b8adc4f02f5c014 /activesupport/lib
parent82ba5c469f8c287329f697be557ac46f34508111 (diff)
downloadrails-7598284c0bd9de93d9bfec4607a64953be1e30f8.tar.gz
rails-7598284c0bd9de93d9bfec4607a64953be1e30f8.tar.bz2
rails-7598284c0bd9de93d9bfec4607a64953be1e30f8.zip
safe_constantize should handle wrong constant name NameErrors Fixes #4710
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/inflector/methods.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb
index 9b0f0e859a..4e6eb27756 100644
--- a/activesupport/lib/active_support/inflector/methods.rb
+++ b/activesupport/lib/active_support/inflector/methods.rb
@@ -243,7 +243,7 @@ module ActiveSupport
begin
constantize(camel_cased_word)
rescue NameError => e
- raise unless e.message =~ /uninitialized constant #{const_regexp(camel_cased_word)}$/ ||
+ raise unless e.message =~ /(uninitialized constant|wrong constant name) #{const_regexp(camel_cased_word)}$/ ||
e.name.to_s == camel_cased_word.to_s
rescue ArgumentError => e
raise unless e.message =~ /not missing constant #{const_regexp(camel_cased_word)}\!$/