Skip to content

Commit

Permalink
Merge pull request rails#51039 from rails/update-release-notes
Browse files Browse the repository at this point in the history
Update 7.0 release notes re inflections and the once autoloader
  • Loading branch information
fxn authored Feb 10, 2024
2 parents 1a92af2 + 5876939 commit 0f9aaa5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions guides/source/upgrading_ruby_on_rails.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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`

[`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/*`.
Expand Down

0 comments on commit 0f9aaa5

Please sign in to comment.