ruby on rails initialized 的顺序

作者: 心似飞鸿
发布时间:2015-07-13 11:31:49

最近做相关项目,遇到了这个难题。经查证,得答案如下:

http://web.archive.org/web/20101010001624/http://www.sekuda.com/rails_initialization_and_configuration_order

 

  1. config/preinitializer.rb
  2. config/environment.rb
  3. config/environments/#{RAILS_ENV}.rb
  4. plugin initialization
  5. gem initialization
  6. config/initializer/*.rb
  7. all after_initialize blocks, in the order they were defined in (so same order as above)
  8. any junk left below the Rails::Initializer.run call/block in environment.rb

以上内容,仅供参考

来源:http://www.cnblogs.com/xinsifeihong/archive/2012/12/27/28364

推荐: