Patch for #1458 - [3.1.0.rc1] App plugins initialized before engines and plugins inside engines
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.



kamipo/rails,yhirano55/rails,printercu/rails,88rabbit/newRails,utilum/rails,printercu/rails,joonyou/rails,mechanicles/rails,gfvcastro/rails,kddeisz/rails,gauravtiwari/rails,Sen-Zhang/rails,untidy-hair/rails,MSP-Greg/rails,felipecvo/rails,schuetzm/rails,palkan/rails,alecspopa/rails,pschambacher/rails,iainbeeston/rails,assain/rails,baerjam/rails,aditya-kapoor/rails,flanger001/rails,mohitnatoo/rails,gcourtemanche/rails,sealocal/rails,rafaelfranca/omg-rails,ttanimichi/rails,bolek/rails,palkan/rails,kamipo/rails,marklocklear/rails,yhirano55/rails,esparta/rails,kddeisz/rails,gcourtemanche/rails,MSP-Greg/rails,MichaelSp/rails,untidy-hair/rails,jeremy/rails,bolek/rails,mohitnatoo/rails,marklocklear/rails,georgeclaghorn/rails,MichaelSp/rails,pvalena/rails,elfassy/rails,tgxworld/rails,tgxworld/rails,ledestin/rails,fabianoleittes/rails,Vasfed/rails,Vasfed/rails,rafaelfranca/omg-rails,baerjam/rails,coreyward/rails,rossta/rails,tjschuck/rails,iainbeeston/rails,kirs/rails-1,amoody2108/TechForJustice,illacceptanything/illacceptanything,tijwelch/rails,bradleypriest/rails,kirs/rails-1,iainbeeston/rails,mijoharas/rails,kenta-s/rails,koic/rails,mtsmfm/rails,sergey-alekseev/rails,mechanicles/rails,betesh/rails,BlakeWilliams/rails,travisofthenorth/rails,illacceptanything/illacceptanything,bogdanvlviv/rails,riseshia/railsguides.kr,bradleypriest/rails,utilum/rails,voray/rails,gavingmiller/rails,Vasfed/rails,kirs/rails-1,bogdanvlviv/rails,yawboakye/rails,repinel/rails,Spin42/rails,rossta/rails,shioyama/rails,esparta/rails,joonyou/rails,maicher/rails,samphilipd/rails,bolek/rails,mijoharas/rails,elfassy/rails,EmmaB/rails-1,mtsmfm/rails,MSP-Greg/rails,odedniv/rails,kamipo/rails,palkan/rails,gfvcastro/rails,utilum/rails,88rabbit/newRails,arunagw/rails,hanystudy/rails,illacceptanything/illacceptanything,eileencodes/rails,esparta/rails,joonyou/rails,kmayer/rails,lucasmazza/rails,Erol/rails,maicher/rails,pschambacher/rails,aditya-kapoor/rails,assain/rails,kmcphillips/rails,tjschuck/rails,ttanimichi/rails,richseviora/rails,kmayer/rails,kmayer/rails,vassilevsky/rails,illacceptanything/illacceptanything,arunagw/rails,kmcphillips/rails,travisofthenorth/rails,mohitnatoo/rails,deraru/rails,yhirano55/rails,schuetzm/rails,illacceptanything/illacceptanything,brchristian/rails,notapatch/rails,odedniv/rails,MichaelSp/rails,Sen-Zhang/rails,coreyward/rails,vipulnsward/rails,mathieujobin/reduced-rails-for-travis,BlakeWilliams/rails,yasslab/railsguides.jp,georgeclaghorn/rails,koic/rails,vipulnsward/rails,gcourtemanche/rails,mohitnatoo/rails,esparta/rails,illacceptanything/illacceptanything,rails/rails,ttanimichi/rails,illacceptanything/illacceptanything,rbhitchcock/rails,notapatch/rails,arjes/rails,stefanmb/rails,BlakeWilliams/rails,rails/rails,prathamesh-sonpatki/rails,rbhitchcock/rails,kaspth/rails,riseshia/railsguides.kr,sealocal/rails,prathamesh-sonpatki/rails,printercu/rails,baerjam/rails,riseshia/railsguides.kr,matrinox/rails,lcreid/rails,untidy-hair/rails,matrinox/rails,lucasmazza/rails,flanger001/rails,mtsmfm/railstest,arjes/rails,coreyward/rails,kaspth/rails,yahonda/rails,travisofthenorth/rails,iainbeeston/rails,richseviora/rails,kddeisz/rails,yalab/rails,amoody2108/TechForJustice,arjes/rails,fabianoleittes/rails,Erol/rails,rails/rails,samphilipd/rails,Spin42/rails,kachick/rails,jeremy/rails,marklocklear/rails,betesh/rails,schuetzm/rails,yalab/rails,Edouard-chin/rails,eileencodes/rails,felipecvo/rails,illacceptanything/illacceptanything,koic/rails,illacceptanything/illacceptanything,Edouard-chin/rails,rbhitchcock/rails,amoody2108/TechForJustice,lcreid/rails,flanger001/rails,repinel/rails,joonyou/rails,Stellenticket/rails,yawboakye/rails,tjschuck/rails,tgxworld/rails,deraru/rails,prathamesh-sonpatki/rails,tijwelch/rails,Stellenticket/rails,deraru/rails,illacceptanything/illacceptanything,voray/rails,vipulnsward/rails,assain/rails,yasslab/railsguides.jp,starknx/rails,ngpestelos/rails,utilum/rails,deraru/rails,printercu/rails,pvalena/rails,illacceptanything/illacceptanything,xlymian/rails,ledestin/rails,mathieujobin/reduced-rails-for-travis,kenta-s/rails,yahonda/rails,aditya-kapoor/rails,gavingmiller/rails,tijwelch/rails,fabianoleittes/rails,vassilevsky/rails,Sen-Zhang/rails,gauravtiwari/rails,yasslab/railsguides.jp,ngpestelos/rails,matrinox/rails,felipecvo/rails,hanystudy/rails,EmmaB/rails-1,samphilipd/rails,kaspth/rails,BlakeWilliams/rails,EmmaB/rails-1,Stellenticket/rails,starknx/rails,shioyama/rails,88rabbit/newRails,Stellenticket/rails,illacceptanything/illacceptanything,gfvcastro/rails,Envek/rails,bradleypriest/rails,sealocal/rails,Erol/rails,Edouard-chin/rails,aditya-kapoor/rails,kmcphillips/rails,voray/rails,mechanicles/rails,alecspopa/rails,gauravtiwari/rails,assain/rails,bogdanvlviv/rails,arunagw/rails,georgeclaghorn/rails,kachick/rails,mtsmfm/railstest,flanger001/rails,mtsmfm/rails,yalab/rails,untidy-hair/rails,mtsmfm/railstest,repinel/rails,maicher/rails,mijoharas/rails,richseviora/rails,betesh/rails,stefanmb/rails,hanystudy/rails,brchristian/rails,rossta/rails,tjschuck/rails,vipulnsward/rails,Envek/rails,xlymian/rails,jeremy/rails,riseshia/railsguides.kr,pschambacher/rails,betesh/rails,yhirano55/rails,illacceptanything/illacceptanything,georgeclaghorn/rails,mathieujobin/reduced-rails-for-travis,illacceptanything/illacceptanything,jeremy/rails,yahonda/rails,repinel/rails,gavingmiller/rails,yalab/rails,notapatch/rails,Envek/rails,lucasmazza/rails,ngpestelos/rails,brchristian/rails,MSP-Greg/rails,baerjam/rails,notapatch/rails,Vasfed/rails,fabianoleittes/rails,alecspopa/rails,Envek/rails,vassilevsky/rails,sergey-alekseev/rails,yawboakye/rails,sergey-alekseev/rails,illacceptanything/illacceptanything,prathamesh-sonpatki/rails,pvalena/rails,odedniv/rails,Erol/rails,Edouard-chin/rails,lcreid/rails,schuetzm/rails,rafaelfranca/omg-rails,rails/rails,eileencodes/rails,gfvcastro/rails,kmcphillips/rails,elfassy/rails,yahonda/rails,yawboakye/rails,lcreid/rails,bogdanvlviv/rails,Spin42/rails,xlymian/rails,palkan/rails,starknx/rails,tgxworld/rails,ledestin/rails,kachick/rails,shioyama/rails,eileencodes/rails,stefanmb/rails,kddeisz/rails,pvalena/rails,arunagw/rails,mechanicles/rails,kenta-s/rails,yasslab/railsguides.jp,travisofthenorth/rails,shioyama/rails