Rails, production-env, “Object is not missing constant”

后端 未结 4 1630
借酒劲吻你
借酒劲吻你 2021-01-15 11:17

So I seems I was stupid and haven\'t checked running in production-env for a long time, and now that I\'m trying to deploy, I\'m getting this annoying error. Any ideas?

相关标签:
4条回答
  • 2021-01-15 11:26

    When I've gotten this error, it's because there's an error in an inner class/module that's inside the class/module mentioned in the error.

    0 讨论(0)
  • 2021-01-15 11:35

    I can't say if this is a typo or the real code but:

    class User < InheritedResources::Base
      include HistoryTools
    end
    

    Should probably be

    class User < ActiveRecord::Base
      include HistoryTools
    end
    

    InheritedResources should be used for controllers, not models.

    0 讨论(0)
  • 2021-01-15 11:37

    You shouldn't have to have the require 'history_tools' in the environment.rb. In that version of Rails all files in the lib folder should be auto-loaded.

    0 讨论(0)
  • 2021-01-15 11:52

    ok, after many more hours of digging, it seems it wasn't even related to this stuff at all. It was an error about 3 more classes down the tree, that was failing for another strange reason, and the exception was apparently being caught by the internals of rails somewhere and just ignored.

    That doesn't explain why it worked in development mode, unfortunately, but at least all my stuff works now. Thanks anyway!

    0 讨论(0)
提交回复
热议问题