我正在尝试按照本教程让 rails 连接到 redis 。但是当我尝试$redis = Redis.new(:host => 'localhost', :port => 6379)
甚至只是Redis.new
. 我也尝试过新的表示法(host: 'localhost',port: 6379)
。Redis 工作(通过 redis-cli 进行 ping-PONG 测试)。
ArgumentError: odd number of arguments for Hash
from /var/lib/gems/1.9.1/gems/redis-2.1.1/lib/redis.rb:65:in `[]'
from /var/lib/gems/1.9.1/gems/redis-2.1.1/lib/redis.rb:65:in `info'
from /var/lib/gems/1.9.1/gems/redis-2.1.1/lib/redis.rb:606:in `inspect'
from /var/lib/gems/1.9.1/gems/railties-4.0.0/lib/rails/commands/console.rb:90:in `start'
from /var/lib/gems/1.9.1/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in `start'
from /var/lib/gems/1.9.1/gems/railties-4.0.0/lib/rails/commands.rb:64:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
我究竟做错了什么?
Config Details:
$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
$ rails -v
Rails 4.0.0