mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #35055 from bughit/patch-1
document the possibility of app initializers running before gem initializers
This commit is contained in:
commit
c5fd501ea4
1 changed files with 2 additions and 0 deletions
|
@ -1239,6 +1239,8 @@ Using Initializer Files
|
|||
|
||||
After loading the framework and any gems in your application, Rails turns to loading initializers. An initializer is any Ruby file stored under `config/initializers` in your application. You can use initializers to hold configuration settings that should be made after all of the frameworks and gems are loaded, such as options to configure settings for these parts.
|
||||
|
||||
NOTE: There is no guarantee that your initializers will run after all the gem initilizers, so any initialization code that depends on a given gem having been initialized should go into a `config.after_initilize` block.
|
||||
|
||||
NOTE: You can use subfolders to organize your initializers if you like, because Rails will look into the whole file hierarchy from the initializers folder on down.
|
||||
|
||||
TIP: While Rails supports numbering of initializer file names for load ordering purposes, a better technique is to place any code that need to load in a specific order within the same file. This reduces file name churn, makes dependencies more explicit, and can help surface new concepts within your application.
|
||||
|
|
Loading…
Reference in a new issue