Skip to content

Commit

Permalink
Document new default of add_autoload_paths_to_load_path
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelfranca committed Jan 11, 2022
1 parent ea5792a commit bfb756b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion guides/source/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Below are the default values associated with each target version. In cases of co
#### Default Values for Target Version 7.1

- [`config.action_dispatch.default_headers`](#config-action-dispatch-default-headers): `{ "X-Frame-Options" => "SAMEORIGIN", "X-XSS-Protection" => "0", "X-Content-Type-Options" => "nosniff", "X-Permitted-Cross-Domain-Policies" => "none", "Referrer-Policy" => "strict-origin-when-cross-origin" }`
- [`add_autoload_paths_to_load_path`](#config-add-autoload-paths-to-load-path): `false`

#### Default Values for Target Version 7.0

Expand Down Expand Up @@ -164,7 +165,14 @@ Accepts an array of paths from which Rails will autoload constants. Default is a

#### `config.add_autoload_paths_to_load_path`

Says whether autoload paths have to be added to `$LOAD_PATH`. This flag is `true` by default, but it is recommended to be set to `false` in `:zeitwerk` mode early, in `config/application.rb`. Zeitwerk uses absolute paths internally, and applications running in `:zeitwerk` mode do not need `require_dependency`, so models, controllers, jobs, etc. do not need to be in `$LOAD_PATH`. Setting this to `false` saves Ruby from checking these directories when resolving `require` calls with relative paths, and saves Bootsnap work and RAM, since it does not need to build an index for them.
Says whether autoload paths have to be added to `$LOAD_PATH`. It is recommended to be set to `false` in `:zeitwerk` mode early, in `config/application.rb`. Zeitwerk uses absolute paths internally, and applications running in `:zeitwerk` mode do not need `require_dependency`, so models, controllers, jobs, etc. do not need to be in `$LOAD_PATH`. Setting this to `false` saves Ruby from checking these directories when resolving `require` calls with relative paths, and saves Bootsnap work and RAM, since it does not need to build an index for them.

The default value depends on the `config.load_defaults` target version:

| Starting with version | The default value is |
| --------------------- | -------------------- |
| (original) | `true` |
| 7.1 | `false` |

#### `config.cache_classes`

Expand Down

0 comments on commit bfb756b

Please sign in to comment.