我有Rails 3.1.3应用程序,并试图插入创业板"redis“到它。
我在Gemfile中添加了以下gem:
宝石“红宝石店”
在本文之后,我将以下代码添加到环境/development.rb. to中:
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‘查找_存储’:找不到redis_store的缓存存储适配器(没有这样的文件来加载- active_support/ cache /redis_ store ) (RuntimeError)。
我已经想出了答案,包括宝石"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‘
’:redis商店不是捆绑包的一部分。把它添加到Gemfile中。(宝石::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救命求你了!
发布于 2012-05-16 22:54:54
菲伊..。我也遇到了类似的问题,直到我将下面的所有内容添加到我的Gemfile中。我正在运行Rails 3.2.3。
gem 'redis'
gem 'redis-store'
gem 'redis-rails'发布于 2014-02-15 16:17:53
这就是你所需要的:
gem 'redis-rails' # Will install several other redis-* gems发布于 2018-04-25 00:26:56
我在Rails 5.2应用程序中也遇到了类似的问题。
结果发现问题在于production.rb中缓存存储的配置。Rails指南指示使用config.cache_store = :redis_cache_store, { url: ENV['REDIS_URL'] },但这是不正确的。
对我有用的是:
在Gemfile中
gem 'redis-rails', '~> 5'在config/environments/production.rb中
config.cache_store = :redis_store, ENV['REDIS_URL']https://stackoverflow.com/questions/9774541
复制相似问题