Always declare ErrorResponseController class to pass zeitwerk check#33
Always declare ErrorResponseController class to pass zeitwerk check#33wilfison wants to merge 1 commit intobjorntrondsen:masterfrom
ErrorResponseController class to pass zeitwerk check#33Conversation
|
Most of the codebase here is 13-14 years old. I am currently doing the bare minimum to keep the gem compatible with new releases of Ruby and Rails, until I can find the time to do a full rewrite. If you only have it enabled in production, then try |
|
This isn't preventing the application from working properly. However, in the future, I plan to add Zeitwerk verification to CI/CD to ensure the autoloader runs smoothly in any environment. That's why I tried to make this small fix. If you plan to rewrite the library, I'm willing to help. |
That's very nice of you to offer - I will try to remember that if we decide to go for it I'll have a look at this patch too |
If you think this fix isn't good, perhaps you could add a warning to the README to use |
The problem
In a rails project, running
rails zeitwerk:checkcomplains that theerror_response_controller.rbfile is not defining a constant that matches the path expected by the autoloader.The solution
Always define the class and only conditionally activate actions. This ensures that the autoloader is satisfied.