diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2012-05-20 16:19:11 -0700 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2012-05-20 16:28:02 -0700 |
commit | 7c95be54b4c3f8ad2273eea39afa233f8f8b31c1 (patch) | |
tree | 9916b2961045e541a450151b6925210e83409ed7 /guides/code/getting_started/test/test_helper.rb | |
parent | 74c4e7ba342d6450b25763652ec0266494a56458 (diff) | |
download | rails-7c95be54b4c3f8ad2273eea39afa233f8f8b31c1.tar.gz rails-7c95be54b4c3f8ad2273eea39afa233f8f8b31c1.tar.bz2 rails-7c95be54b4c3f8ad2273eea39afa233f8f8b31c1.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 'guides/code/getting_started/test/test_helper.rb')
0 files changed, 0 insertions, 0 deletions