@@ -104,9 +104,29 @@ TODO: Add description https://github.com/rails/rails/pull/47880
104
104
105
105
TODO: Add description https://github.com/rails/rails/pull/47770
106
106
107
- ### Introduce ` config.autoload_lib `
107
+ ### Introducing ` config.autoload_lib ` and ` config.autoload_lib_once ` for Enhanced Autoloading
108
108
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 )
110
130
111
131
### Active Record API for general async queries
112
132
0 commit comments