diff options
author | Joseph Wong <joseph.wong@sap.com> | 2011-06-16 13:24:33 -0700 |
---|---|---|
committer | Joseph Wong <joseph.wong@sap.com> | 2011-06-16 13:24:33 -0700 |
commit | 29dfe05e075c3369c1182ba1ff0ba92755287d3c (patch) | |
tree | 53691bdc52d7ca3d04de7ae60a1700f95874602b /railties | |
parent | be99ae78c9c4b52541297f0fb146701070041c02 (diff) | |
download | rails-29dfe05e075c3369c1182ba1ff0ba92755287d3c.tar.gz rails-29dfe05e075c3369c1182ba1ff0ba92755287d3c.tar.bz2 rails-29dfe05e075c3369c1182ba1ff0ba92755287d3c.zip |
Patch for #1458 - [3.1.0.rc1] App plugins initialized before engines
and plugins inside engines
It seems that plugins inside a Rails 3.1 application proper (i.e. in
/vendor/plugins) are initialized before engines and plugins inside
engines.
After some debugging, I found the culprit in
Rails::Application::Railties#all:
def all(&block)
@all ||= railties + engines + super
@all.each(&block) if block
@all
end
The call to super here implicitly passes the &block argument, which
has the unfortunate side-effect of adding the plugin initializers
first (in front of other railties and engines) in the case of
Rails::Engine#initializers:
def initializers
initializers = []
railties.all { |r| initializers += r.initializers }
initializers += super
initializers
end
The solution here is to replace the super call with a call
to #plugins.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/application/railties.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/railties/lib/rails/application/railties.rb b/railties/lib/rails/application/railties.rb index 4fc5e92837..8f3a3e8bbb 100644 --- a/railties/lib/rails/application/railties.rb +++ b/railties/lib/rails/application/railties.rb @@ -4,7 +4,7 @@ module Rails class Application < Engine class Railties < Rails::Engine::Railties def all(&block) - @all ||= railties + engines + super + @all ||= railties + engines + plugins @all.each(&block) if block @all end |