【发布时间】:2012-04-04 04:42:47
【问题描述】:
我有 Rails 3.1.3 应用程序并尝试将 gem "redis" 插入它。
我已将以下 gem 添加到 Gemfile:
gem "redis-store"
在这篇文章之后,我在environments/development.rb中添加了以下代码:
config.gem "redis-store", :lib => "redis-store"
require "redis-store" # HACK
config.cache_store = :redis_store
应用无法启动,向 cache_store 抱怨:
/gems/activesupport-3.1.3/lib/active_support/cache.rb:65:in `lookup_store': 找不到 redis_store 的缓存存储适配器(没有要加载的文件——active_support/cache/redis_store)(运行时错误)。
我已经想通了,包括 gem "redis-rails" 而不是 "redis-store",但我遇到了另一个错误:
/Users/AntonAL/.rvm/gems/ree-1.8.7-2011.03@global/gems/bundler-1.0.21/lib/bundler/rubygems_integration.rb:143:in `gem': redis-store 是不是捆绑包的一部分。将其添加到 Gemfile。 (Gem::LoadError)
两者兼得……
gem 'redis-store'
gem 'redis-rails'
...给出另一个错误
…gems/redis-rails-0.0.0/lib/redis-rails/version.rb:1: Redis is not a module (TypeError)
from …/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from …/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from …/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
from …/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
from …/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
from …/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from …/gems/redis-rails-0.0.0/lib/redis-rails.rb:1
from …/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
from …/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
from …/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
from …/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `require'
from …/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
from …/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
from …/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
from …/config/application.rb:11
from …/gems/railties-3.1.3/lib/rails/commands.rb:52:in `require'
from …/gems/railties-3.1.3/lib/rails/commands.rb:52
from …/gems/railties-3.1.3/lib/rails/commands.rb:49:in `tap'
from …/gems/railties-3.1.3/lib/rails/commands.rb:49
from script/rails:6:in `require'
from script/rails:6
请帮忙!
【问题讨论】:
标签: ruby-on-rails-3 redis