lib/active_support/dependencies.rb in activesupport-4.1.5 vs lib/active_support/dependencies.rb in activesupport-4.1.6.rc1

- old
+ new

@@ -184,11 +184,11 @@ # it can be proven that is not the case), and the path to the file that # defines the constant. Anonymous modules cannot follow these conventions # and we assume therefore the user wants to refer to a top-level constant. def guess_for_anonymous(const_name) if Object.const_defined?(const_name) - raise NameError, "#{const_name} cannot be autoloaded from an anonymous class or module" + raise NameError.new "#{const_name} cannot be autoloaded from an anonymous class or module", const_name else Object end end @@ -513,12 +513,12 @@ rescue NameError => e raise unless e.missing_name? qualified_name_for(parent, const_name) end end - raise NameError, - "uninitialized constant #{qualified_name}", - caller.reject { |l| l.starts_with? __FILE__ } + name_error = NameError.new("uninitialized constant #{qualified_name}", const_name) + name_error.set_backtrace(caller.reject {|l| l.starts_with? __FILE__ }) + raise name_error end # Remove the constants that have been autoloaded, and those that have been # marked for unloading. Before each constant is removed a callback is sent # to its class/module if it implements +before_remove_const+.