aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorbughit <bughit@users.noreply.github.com>2019-01-25 13:32:26 -0500
committerGitHub <noreply@github.com>2019-01-25 13:32:26 -0500
commit1c5e2f9b98bc5b50ac990d6f1b0ae9df59580444 (patch)
tree6b1af8f920e874df2ebd1fb80447d82fb1ac7b38 /guides
parentbf3a8a0e6ce13b7db50abe5288d2cc74c2e8975e (diff)
downloadrails-1c5e2f9b98bc5b50ac990d6f1b0ae9df59580444.tar.gz
rails-1c5e2f9b98bc5b50ac990d6f1b0ae9df59580444.tar.bz2
rails-1c5e2f9b98bc5b50ac990d6f1b0ae9df59580444.zip
document the possibility of app initializers running before gem initilizers
and suggest a workaround
Diffstat (limited to 'guides')
-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.