This issue https://github.com/rails/rails/issues/38868 has bitten both people in my team as well as industry acquaintances. I understand that that is how zeitwerk loads things in, but it feels like a massive disservice to silently swallow exceptions and leave developers to scratch their heads at why their templates are rendering but their controller actions don’t seem to be invoked.
Is this still the case?
Rails improved the way to distinguish between a NameError
raised by the autoloader, and a different NameError
. If you have an unknown constant at the top-level, the exception bubbles up:
NameError (uninitialized constant UsersController::FOOBAR)
and if you call an inexistent class method, similar behavior:
NameError (undefined local variable or method `foobar' for UsersController:Class)
If you’ve got a case where this still happens, please let me know how to reproduce.
1 Like
Hi,
I just went to replicate this issue again and noticed 6.0.3 had dropped and this is not the case anymore in 6.0.3 (it was still in 6.0.2.2).
Many thanks!
5 Likes