aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2019-01-26 02:12:13 -0500
committerGitHub <noreply@github.com>2019-01-26 02:12:13 -0500
commitc5fd501ea4057e052c2b08c2872b8998b46ba8f7 (patch)
tree264c02ac1fe179ab8351d6d43af18e6f4d6be711
parent8ae241401a2bff25f70befd2adcb35d541b9bc07 (diff)
parent1c5e2f9b98bc5b50ac990d6f1b0ae9df59580444 (diff)
downloadrails-c5fd501ea4057e052c2b08c2872b8998b46ba8f7.tar.gz
rails-c5fd501ea4057e052c2b08c2872b8998b46ba8f7.tar.bz2
rails-c5fd501ea4057e052c2b08c2872b8998b46ba8f7.zip
Merge pull request #35055 from bughit/patch-1
document the possibility of app initializers running before gem initializers
-rw-r--r--guides/source/configuring.md2
1 files changed, 2 insertions, 0 deletions
diff --git a/guides/source/configuring.md b/guides/source/configuring.md
index a727dcd010..a329deb710 100644
--- a/guides/source/configuring.md
+++ b/guides/source/configuring.md
@@ -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.