1---
2stage: none
3group: unassigned
4info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
5---
6
7# Rails initializers
8
9By default, Rails loads Zeitwerk after the initializers in `config/initializers` are loaded.
10Autoloading before Zeitwerk is loaded is now deprecated but because we use a lot of autoloaded
11constants in our initializers, we had to move the loading of Zeitwerk earlier than these
12initializers.
13
14A side-effect of this is that in the initializers, `config.autoload_paths` is already frozen.
15
16To run an initializer before Zeitwerk is loaded, you need put them in `config/initializers_before_autoloader`.
17Ruby files in this folder are loaded in alphabetical order just like the default Rails initializers.
18
19Some examples where you would need to do this are:
20
211. Modifying Rails' `config.autoload_paths`
221. Changing configuration that Zeitwerk uses, for example, inflections
23