Rails is amazing, I spend most of my professional life working in it, and love it. Thank you all!
The recent rails 6.0 upgrades introduced the Zeitwerk loader which has been mostly smooth for me across my many projects, with one exception.
The deprecation about autoloading constants during initialization doesn’t provide enough information to pinpoint the invocation that loaded the classes too early.
DEPRECATION WARNING: Initialization autoloaded the constants x, y, and z.
Being able to do this is deprecated. Autoloading during initialization is going to be an error condition in future versions of Rails.
Reloading does not reboot the application, and therefore code executed during initialization does not run again. So, if you reload ApplicationRecord, for example, the expected changes won’t be reflected in that stale Class object.
These autoloaded constants have been unloaded.
Please, check the “Autoloading and Reloading Constants” guide for solutions. (called from <top (required)> at …exampleapp/config/environment.rb:5)
The guide is great, but with large projects, for which I was not the only author and I don’t know every corner tracking down these invocations is still difficult. It would be tremendously helpful if there were any way to track an enumerate the specific invocations in the deprecation message.