An initialized constant error occurs in the production environment of rails5.
There are no errors in the development environment, and I am writing to inquire about the cause.
「 If you run this command without "-e production", it will be successful.
※ Class Name is located under lib.
◆ Application.rb Settings
Also, please let me know if there are any other parameters you need for analysis.ruby-on-rails
In rails5+, eager_load_paths and auto_load_paths are assumed to be generated from config.paths on their own.
config.paths.add 'lib', eager_load:true is needed, and I think it would be better to configure paths in this format only.
I probably solved it myself, so I will write down the answer as a reminder.
◆ application.rb (before modification)
◆ application.rb (modified)
The following three points were implemented.
※ Comment out autoload_paths (because it is deprecated in Rails5)
※ Modify "~lib/**/" in eager_load_paths to "~lib/"
※ Reboot Production
It is not clear at this time why this worked.
If anyone knows, please write it down.
© 2023 OneMinuteCode. All rights reserved.