所以我似乎是愚蠢的,并没有检查生产env运行很长一段时间,现在我正在尝试部署,我得到这个恼人的错误.有任何想法吗?
LIB / history_tools.rb
- module HistoryTools
- def self.included(base)
- base.has_many :history,:dependent => :destroy
- History::TYPES.each do |htype|
- base.has_many "history_#{htype}",:class_name => "History::#{htype.capitalize}"
- end
- end
- # ... other minor things removed ...
- end
应用程序/模型/ user.rb
- class User < InheritedResources::Base
- include HistoryTools
- end
到config / environment.rb
- # ... the usual stuff,then,at the very bottom:
- require 'history_tools'
这给出了错误:
- activesupport-2.3.8/lib/active_support/dependencies.rb:417:in
- `load_missing_constant':ArgumentError: Object is not missing
- constant HistoryTools!
如果我在user.rb的顶部添加一个额外的require’history_tools’,它会修复该错误,我相信,但是它在找到#{RAILS_ROOT} / lib中的其他东西时失败了,这在环境中是必需的.rb in以同样的方式.
踢球者:这在开发模式下完美运行.它只会在生产中出现此错误.我的大部分谷歌搜索似乎表明“不丢失常量”错误与Rails如何自动加载文件有关,当没有任何内容卸载时,这些文件应该在生产中消失.这似乎与这种行为相反?