File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -507,10 +507,10 @@ Zeitwerk supports [custom root namespaces](https://github.com/fxn/zeitwerk#custo
507
507
#
508
508
# In this example we define the module on the spot. Could also be created
509
509
# 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.
511
511
module Services ; end
512
512
513
- Rails .autoloaders.main.push_dir(" #{ Rails .root} /app/services" , Services )
513
+ Rails .autoloaders.main.push_dir(" #{ Rails .root} /app/services" , namespace: Services )
514
514
```
515
515
516
516
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:
Original file line number Diff line number Diff line change 11
11
#
12
12
# In this example we define the module on the spot. Could also be created
13
13
# 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.
15
15
module Services ; end
16
16
17
- Rails .autoloaders.main.push_dir(" #{ Rails .root} /app/services" , Services )
17
+ Rails .autoloaders.main.push_dir(" #{ Rails .root} /app/services" , namespace: Services )
18
18
```
19
19
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.
23
21
24
22
* Xavier Noria *
25
23
You can’t perform that action at this time.
0 commit comments