Commit 2b38831
committed
Fix default mailer class not resolving with autoloading in background jobs
The `Rodauth::Rails::Feature` class gets autoloaded only when the Rodauth
configuration is getting evaluated. In the web server, this happens immediately
before the request reaches the Rails router, because the Rodauth middleware
loads the Rodauth app, which in turn loads Rodauth configuration.
However, in a background job process, enqueued email deliveries will first
resolve the mailer class, and then the mailer will load the Rodauth
configuration. So, the job processor will attempt to resolve
`Rodauth::Rails::Feature::Email::Mailer`, which fails, because the `rails`
Rodauth feature hasn't yet been loaded.
The solution is simple: move the mailer class in a place where it can be
autoloaded without the feature being loaded. As a bonus, this results in a much
shorter `Rodauth::Rails::Mailer` class.
Fixes #3371 parent 65bf4ce commit 2b38831
3 files changed
+11
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | 22 | | |
30 | 23 | | |
31 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
0 commit comments