我有Rails 3.1.3應用程序,並試圖插入寶石「redis」。找不到緩存存儲適配器redis_store
我添加以下寶石的Gemfile:
寶石 「的Redis店」
這篇文章之後,我已經添加以下代碼,以環境/ 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)(RuntimeError)。
我已經想通了,包括寶石「redis的護欄」,而不是「redis的店」,但我發現了另一個錯誤:
/Users/AntonAL/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/rubygems_integration.rb:143:in `gem': redis-store is not part of the bundle. Add it to 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
幫助,請!
謝謝,最近我還找到了解決方案。我可以指定與我的rails環境版本相匹配的「redis-store」版本。 – AntonAL 2012-03-26 12:01:15
Blam!感謝噸million.rand – Trip 2012-05-01 19:20:46