diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2016-12-14 11:47:51 +0100 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2016-12-14 14:25:43 +0100 |
commit | 11e05defecde965e0eb1929f1b0f1f992be39a6b (patch) | |
tree | 2743c8f2f18edf9aaf4bea170805fe080e216d89 /guides/source/4_1_release_notes.md | |
parent | e3e663f1dc40a5cfae9ec60e32f5372cd7f9885b (diff) | |
download | rails-11e05defecde965e0eb1929f1b0f1f992be39a6b.tar.gz rails-11e05defecde965e0eb1929f1b0f1f992be39a6b.tar.bz2 rails-11e05defecde965e0eb1929f1b0f1f992be39a6b.zip |
Fix constantize edge case involving prepend, autoloading and name conflicts
In the following situation:
```ruby
class Bar
end
module Baz
end
class Foo
prepend Baz
end
class Foo::Bar
end
```
Running `Inflector.constantize('Foo::Bar')` would blow up with a NameError.
What is happening is that `constatize` was written before the introduction
of prepend, and wrongly assume that `klass.ancestors.first == klass`.
So it uses `klass.ancestors.inject` without arguments, as a result
a prepended module is used in place of the actual class.
Diffstat (limited to 'guides/source/4_1_release_notes.md')
0 files changed, 0 insertions, 0 deletions