1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/lib/rails/application
Joseph Wong 29dfe05e07 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.
2011-06-16 13:24:33 -07:00
..
bootstrap.rb ADdd missing requires (thanks to @arunagw) 2011-05-07 13:35:21 +02:00
configuration.rb Proper fix 2011-05-12 10:57:55 -05:00
finisher.rb Explicitly define main_app proxy 2011-04-25 14:56:58 +02:00
railties.rb Patch for #1458 - [3.1.0.rc1] App plugins initialized before engines 2011-06-16 13:24:33 -07:00
routes_reloader.rb Refactored routes reloading to use RouteSet#append instead keeping block in Engine 2010-10-08 18:23:25 +02:00