Commit 989315d
Fix Rails 7.1 Zeitwerk eager loading in engine initializer
Rails 7.1 minimum version upgrade exposed timing issue where engine
initializer tried to access job classes before Zeitwerk loaded them.
Problem:
- bin/rails zeitwerk:check failed with "uninitialized constant" errors
- Production environments with config.eager_load = true would fail during boot
- ActiveSupport.on_load(:active_job) hook runs when ActiveJob framework loads,
but job classes in app/jobs/ may not be loaded yet during eager loading
Solution:
- Replace on_load hook with config.after_initialize
Ensures all classes are loaded before configuration runs, working correctly
in both development (autoload) and production (eager load) environments
- Add ShopifyApp:: namespace to job class references
Required for explicit constant resolution during eager loading
- Add Active Storage config for test dummy app
Rails 7.1 requires config/storage.yml when eager loading is enabled
Result: bin/rails zeitwerk:check now passes. Engine properly configures
job logging in all loading scenarios.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent ab2cff7 commit 989315d
2 files changed
+13
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
33 | 31 | | |
34 | 32 | | |
35 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
0 commit comments