Configuration load order in Rails19.01.2015 - Pascal Betz
Ever wondered what the load order of the various configuration files of Rails is?
In Rails the (more or less) common places to configure your app are:
- after_initialize callbacks (in application.rb or in environment specific files)
Since there is multiple points where you can add the configuration the order in which those configurations are applied is important. E.g. it might happen that you set a value in one place and it gets reverted from another config file. This is the order that get’s applied, tested in Rails 4.2
- environment specific config file in config/environments/*.rb
- initializers, they are loaded in alphabetical order
- after_initialize callbacks, in the order they have been added