我正在将 Rails 2.3.11 应用程序升级到 3.0.10。当我尝试运行任何 rails 脚本(如)或运行我的单元测试时NameError
,我的文件中出现了一个。development.rb
rails console
我正在调用我在 中定义的类lib
,但调用该类时似乎尚未加载该库development.rb
。
我正在做类似的事情:
config.cache_store = CustomMemcachedStore.new(Memcached.new(...))
我有一个lib/custom_memcached_store.rb
声明类的文件
class CustomMemcachedStore < ActiveSupport::Cache::Store
我收到以下错误:
~/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing': uninitialized constant CustomMemcachedStore (NameError)
from ~/app_name/config/environments/development.rb:20:in `block in <top (required)>'
在application.rb
,我已经在使用
config.autoload_paths += Dir["#{Rails.root}/lib"]
感谢你给与我的帮助。