rails/rails — pull request #15162 by yuki24 (2014-05-17 22:21:31+00:00)
Title: Fix a bug that AS::Dependencies changes the behaivior of NameError#name

I noticed that NameError objects loses a const name after `require 'active_support/dependencies'`. The following example replicates the bug fixed in this commit:

```ruby
begin
DoesNotExist
rescue NameError => e
e.name # => :DoesNotExist
end

class A; end

begin
A::DoesNotExistNeither
rescue NameError => e
e.name # => :DoesNotExistNeither
end

require 'active_support/dependencies'

begin
DoesNotExist
rescue NameError => e
e.name # => nil
end

begin
A::DoesNotExistNeither
rescue NameError => e
e.name # => nil
end
```

This commit changes AS::Dependencies to not just raise NameError but create an object first and raise the object so `NameError#name` will never be `nil`.

I'll send other pull request if I find this bug in more places in Rails.