Commit d3f4d0f
Fix Zeitwerk eager loading crash in non-Rails environments
Applications were crashing during Zeitwerk eager loading when railtie.rb
references Rails::Railtie in non-Rails contexts. This happened because
Zeitwerk's eager loading occurs before conditional require checks can run.
This fix implements two complementary changes:
1. Wrap the Railtie class definition with a conditional check in railtie.rb
2. Tell Zeitwerk to ignore railtie.rb using loader.ignore()
This ensures the file is only loaded in Rails environments and prevents
NameError crashes during eager loading.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 3b08a4a commit d3f4d0f
2 files changed
+15
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
104 | | - | |
105 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
| |||
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
0 commit comments