Why isn't my production Rails server resolving constants?

五迷三道 提交于 2019-12-12 01:36:37

问题


We just updated to Rails 5.

All tests now pass. I'm able to spin up a web server and everything appears to work. But over on the production server, some URLs give an error like this:

uninitialized constant #<Class:0x0055b8d9dedf68>::JsonUtils
app/models/thing.rb:71:in `as_json'

JsonUtils lives in app/lib/json_utils.rb. (We moved them to app/lib when lib was taken out of the autoload paths in the past.)

If I run bin/rails console development, and actually, even if I run bin/rails console production, I can type JsonUtils and it resolves fine. Yet when the application is running for real, this class can't be resolved.

Has anyone else seen something like this?

来源:https://stackoverflow.com/questions/39695129/why-isnt-my-production-rails-server-resolving-constants

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!