【发布时间】:2010-10-30 01:44:11
【问题描述】:
所以我似乎很愚蠢并且很长时间没有检查在生产环境中的运行情况,现在我正在尝试部署,我收到了这个烦人的错误。有什么想法吗?
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
app/models/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 中找到其他需要的东西在 environment.rb 中以相同的方式。
踢球者:这在开发模式下完美运行。它只会在生产中给出这个错误。我的大部分谷歌搜索似乎表明“不丢失常量”错误与 Rails 如何自动加载文件有关,当没有卸载任何内容时,这些文件应该在生产中消失。这似乎与那种行为相反?
【问题讨论】:
标签: ruby-on-rails