ruby-on-rails – Rails,production-env,“对象不会丢失常数”
发布时间:2020-12-16 20:46:31 所属栏目:百科 来源:网络整理
导读:所以我似乎是愚蠢的,并没有检查生产env运行很长一段时间,现在我正在尝试部署,我得到这个恼人的错误.有任何想法吗? LIB / history_tools.rb module HistoryTools def self.included(base) base.has_many :history,:dependent = :destroy History::TYPES.each
所以我似乎是愚蠢的,并没有检查生产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如何自动加载文件有关,当没有任何内容卸载时,这些文件应该在生产中消失.这似乎与这种行为相反? 解决方法
当我收到此错误时,这是??因为错误中提到的类/模块内部类/模块中存在错误.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |