diff options
author | Guo Xiang Tan <tgx_world@hotmail.com> | 2014-08-10 14:56:03 +0800 |
---|---|---|
committer | Guo Xiang Tan <tgx_world@hotmail.com> | 2014-09-02 00:41:00 +0800 |
commit | 6e0f273dfd4dc30ec4fa1c6db1079f5fd3f717ff (patch) | |
tree | 6760eb4e8e150e0084d782dafb32f4791aa1e3cd /activesupport/lib | |
parent | fcbdac7e82725c388bf5adf56a9a9a16d4efdbe0 (diff) | |
download | rails-6e0f273dfd4dc30ec4fa1c6db1079f5fd3f717ff.tar.gz rails-6e0f273dfd4dc30ec4fa1c6db1079f5fd3f717ff.tar.bz2 rails-6e0f273dfd4dc30ec4fa1c6db1079f5fd3f717ff.zip |
Use `safe_constantize`.
Fixes https://github.com/rails/rails/issues/9933.
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/testing/constant_lookup.rb | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/activesupport/lib/active_support/testing/constant_lookup.rb b/activesupport/lib/active_support/testing/constant_lookup.rb index 1b2a75c35d..07d477c0db 100644 --- a/activesupport/lib/active_support/testing/constant_lookup.rb +++ b/activesupport/lib/active_support/testing/constant_lookup.rb @@ -36,12 +36,8 @@ module ActiveSupport while names.size > 0 do names.last.sub!(/Test$/, "") begin - constant = names.join("::").constantize + constant = names.join("::").safe_constantize break(constant) if yield(constant) - rescue NoMethodError # subclass of NameError - raise - rescue NameError - # Constant wasn't found, move on ensure names.pop end |