mirror of https://github.com/rails/rails
Merge pull request #51039 from rails/update-release-notes
Update 7.0 release notes re inflections and the once autoloader
This commit is contained in:
commit
0f9aaa5ca9
|
@ -477,6 +477,20 @@ to be an error condition in future versions of Rails.
|
||||||
|
|
||||||
If you still get this warning in the logs, please check the section about autoloading when the application boots in the [autoloading guide](https://guides.rubyonrails.org/v7.0/autoloading_and_reloading_constants.html#autoloading-when-the-application-boots). You'd get a `NameError` in Rails 7 otherwise.
|
If you still get this warning in the logs, please check the section about autoloading when the application boots in the [autoloading guide](https://guides.rubyonrails.org/v7.0/autoloading_and_reloading_constants.html#autoloading-when-the-application-boots). You'd get a `NameError` in Rails 7 otherwise.
|
||||||
|
|
||||||
|
Constants managed by the `once` autoloader can be autoloaded during initialization, and they can be used normally, no need for a `to_prepare` block. However, the `once` autoloader is now set up earlier to support that. If the application has custom inflections, and the `once` autoloader should be aware of them, you need to move the code in `config/initializers/inflections.rb` to the body of the application class definition in `config/application.rb`:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
module MyApp
|
||||||
|
class Application < Rails::Application
|
||||||
|
# ...
|
||||||
|
|
||||||
|
ActiveSupport::Inflector.inflections(:en) do |inflect|
|
||||||
|
inflect.acronym "HTML"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
### Ability to configure `config.autoload_once_paths`
|
### Ability to configure `config.autoload_once_paths`
|
||||||
|
|
||||||
[`config.autoload_once_paths`][] can be set in the body of the application class defined in `config/application.rb` or in the configuration for environments in `config/environments/*`.
|
[`config.autoload_once_paths`][] can be set in the body of the application class defined in `config/application.rb` or in the configuration for environments in `config/environments/*`.
|
||||||
|
|
Loading…
Reference in New Issue