Skip to content

Commit 7b6e25c

Browse files
committed
documents support for zeitwerk mode inflectors overrides in CHANGELOG [skip ci]
1 parent 035ea91 commit 7b6e25c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

activesupport/CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
* The default inflectors in `zeitwerk` mode support overrides:
2+
3+
```ruby
4+
# config/initializers/zeitwerk.rb
5+
Rails.autoloaders.each do |autoloader|
6+
autoloader.inflector.inflect(
7+
"html_parser" => "HTMLParser",
8+
"ssl_error" => "SSLError"
9+
)
10+
end
11+
```
12+
13+
That way, you can tweak how individual basenames are inflected without touching Active Support inflection rules, which are global. These inflectors fallback to `String#camelize`, so existing inflection rules are still taken into account for non-overridden basenames.
14+
15+
Please, check the [autoloading guide for `zeitwerk` mode](https://guides.rubyonrails.org/v6.0/autoloading_and_reloading_constants.html#customizing-inflections) if you prefer not to depend on `String#camelize` at all.
16+
17+
*Xavier Noria*
18+
119
* Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
220
and endless range targets.
321

0 commit comments

Comments
 (0)