Skip to content

Commit 779c14b

Browse files
committed
Edits in example code and railties CHANGELOG
1 parent d0d9e8e commit 779c14b

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

guides/source/autoloading_and_reloading_constants.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,10 +507,10 @@ Zeitwerk supports [custom root namespaces](https://github.com/fxn/zeitwerk#custo
507507
#
508508
# In this example we define the module on the spot. Could also be created
509509
# elsewhere and its definition loaded here with an ordinary `require`. In
510-
# any case, `push_dir` expects a class or module object as second argument.
510+
# any case, `push_dir` expects a class or module object.
511511
module Services; end
512512

513-
Rails.autoloaders.main.push_dir("#{Rails.root}/app/services", Services)
513+
Rails.autoloaders.main.push_dir("#{Rails.root}/app/services", namespace: Services)
514514
```
515515

516516
Applications running on Rails < 7.1 have to additionally delete the directory from `ActiveSupport::Dependencies.autoload_paths`. Just add this line to the same file:

railties/CHANGELOG.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@
1111
#
1212
# In this example we define the module on the spot. Could also be created
1313
# elsewhere and its definition loaded here with an ordinary `require`. In
14-
# any case, `push_dir` expects a class or module object as second argument.
14+
# any case, `push_dir` expects a class or module object.
1515
module Services; end
1616

17-
Rails.autoloaders.main.push_dir("#{Rails.root}/app/services", Services)
17+
Rails.autoloaders.main.push_dir("#{Rails.root}/app/services", namespace: Services)
1818
```
1919

20-
Before this change, Rails would later override the configuration. You had to
21-
delete `app/services` from `ActiveSupport::Dependencies.autoload_paths` as
22-
well.
20+
Check the autoloading guide for further details.
2321

2422
*Xavier Noria*
2523

0 commit comments

Comments
 (0)