Skip to content

Commit 2bc9e8c

Browse files
authored
Merge pull request rails#49054 from akhilgkrishnan/autoload_lib_release_note
[skip ci] config.autoload_lib method description added in 7.1 release note
2 parents 735cba5 + 6b507f8 commit 2bc9e8c

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

guides/source/7_1_release_notes.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,29 @@ TODO: Add description https://github.com/rails/rails/pull/47880
104104

105105
TODO: Add description https://github.com/rails/rails/pull/47770
106106

107-
### Introduce `config.autoload_lib`
107+
### Introducing `config.autoload_lib` and `config.autoload_lib_once` for Enhanced Autoloading
108108

109-
TODO: Add description https://github.com/rails/rails/pull/48572
109+
A [new configuration method, `config.autoload_lib(ignore:)`](https://github.com/rails/rails/pull/48572),
110+
has been introduced. This method is used to enhance the autoload paths of applications by including the
111+
`lib` directory, which is not included by default. Also, `config.autoload_lib(ignore: %w(assets tasks))`
112+
is generated for new applications.
113+
114+
When invoked from either `config/application.rb` or `config/environments/*.rb`, this method adds the
115+
`lib` directory to both `config.autoload_paths` and `config.eager_load_paths`. It's important to note
116+
that this feature is not available for engines.
117+
118+
To ensure flexibility, the `ignore` keyword argument can be used to specify subdirectories within the
119+
`lib` directory that should not be managed by the autoloaders. For instance, you can exclude directories
120+
like `assets`, `tasks`, and `generators` by passing them to the `ignore` argument:
121+
122+
```ruby
123+
config.autoload_lib(ignore: %w(assets tasks generators))
124+
```
125+
126+
The [`config.autoload_lib_once` method](https://github.com/rails/rails/pull/48610) is similar to
127+
`config.autoload_lib`, except that it adds `lib` to `config.autoload_once_paths` instead.
128+
129+
Please, see more details in the [autoloading guide](autoloading_and_reloading_constants.html#config-autoload-lib-ignore)
110130

111131
### Active Record API for general async queries
112132

0 commit comments

Comments
 (0)