diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2012-05-20 16:19:11 -0700 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2012-05-20 17:04:30 -0700 |
commit | b0f8355d2813c375bf9242071131e8c5a350bcf0 (patch) | |
tree | 95cfc865bbaf083cc98aef4afb182f2ac4910232 /railties/lib/rails/generators/test_unit/scaffold | |
parent | 68a454c2afcbfc1bd71c06e0a7d9cd48d5cf4412 (diff) | |
download | rails-b0f8355d2813c375bf9242071131e8c5a350bcf0.tar.gz rails-b0f8355d2813c375bf9242071131e8c5a350bcf0.tar.bz2 rails-b0f8355d2813c375bf9242071131e8c5a350bcf0.zip |
Fix generators to help with ambiguous `ApplicationController` issue
In development mode, dependencies are loaded dynamically at runtime,
using `const_missing`. Because of that, when one of the constants is
already loaded and `const_missing` is not triggered, user can end up
with unexpected results.
Given such file in an Engine:
```ruby
module Blog
class PostsController < ApplicationController
end
end
```
If you load it first, before loading any application files, it will
correctly load `Blog::ApplicationController`, because second line will
hit `const_missing`. However if you load `ApplicationController` first,
the constant will be loaded already, `const_missing` hook will not be
fired and in result `PostsController` will inherit from
`ApplicationController` instead of `Blog::ApplicationController`.
Since it can't be fixed in `AS::Dependencies`, the easiest fix is to
just explicitly load application controller.
closes #6413
Diffstat (limited to 'railties/lib/rails/generators/test_unit/scaffold')
0 files changed, 0 insertions, 0 deletions