diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-07-29 14:38:57 -0700 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-08-13 16:22:24 -0700 |
commit | f85b9662699d7b77fd9ad4e1303565fdaaed0379 (patch) | |
tree | 9d426b5808231f0e1ad7c716b1df1681fc7fd992 | |
parent | 4a744938167067978ce428c3e2b1efb0b4f05141 (diff) | |
download | rails-f85b9662699d7b77fd9ad4e1303565fdaaed0379.tar.gz rails-f85b9662699d7b77fd9ad4e1303565fdaaed0379.tar.bz2 rails-f85b9662699d7b77fd9ad4e1303565fdaaed0379.zip |
delay backtrace scrubbing until we actually raise an exception. fixes #1936
-rw-r--r-- | activesupport/lib/active_support/dependencies.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb index 8cd4d15e4c..3f6c93e860 100644 --- a/activesupport/lib/active_support/dependencies.rb +++ b/activesupport/lib/active_support/dependencies.rb @@ -478,10 +478,6 @@ module ActiveSupport #:nodoc: qualified_name = qualified_name_for from_mod, const_name path_suffix = qualified_name.underscore - trace = caller.reject {|l| l.starts_with? __FILE__ } - name_error = NameError.new("uninitialized constant #{qualified_name}") - name_error.set_backtrace(trace) - file_path = search_for_file(path_suffix) if file_path && ! loaded.include?(File.expand_path(file_path)) # We found a matching file to load @@ -500,11 +496,12 @@ module ActiveSupport #:nodoc: return parent.const_missing(const_name) rescue NameError => e raise unless e.missing_name? qualified_name_for(parent, const_name) - raise name_error end - else - raise name_error end + + raise NameError, + "uninitialized constant #{qualified_name}", + caller.reject {|l| l.starts_with? __FILE__ } end # Remove the constants that have been autoloaded, and those that have been |