【发布时间】:2011-09-12 21:32:19
【问题描述】:
我正在将 Rails 2.3.11 应用程序升级到 3.0.10。当我尝试运行rails console 之类的任何rails 脚本或运行我的单元测试时,我在development.rb 文件中得到了NameError。
我正在调用我在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"]
感谢您能给我的任何帮助。
【问题讨论】:
标签: ruby-on-rails ruby-on-rails-3 rails-3-upgrade