未初始化的常量Redis(NameError)

时间:2014-06-17 14:04:53

标签: ruby-on-rails redis god

我有一个RoR应用程序,我正在监视上帝。我可以使用

启动unicorn服务器而不会出现问题
unicorn -E production -c config/unicorn.rb

一切正常。虽然当我尝试使用像这样的神启动服务器时

god start my-god-task-name

我得到一个uninitialized constatnt (NameError)异常,并将以下输出写入我的日志文件。

/var/www/beta.foerderapp.ch/releases/20140617123149/config/initializers/redis_starter.rb:2:in `<top (required)>': uninitialized constant Redis (NameError)
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.9/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.9/lib/rails/engine.rb:587:in `each'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.9/lib/rails/engine.rb:587:in `block in <class:Engine>'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.9/lib/rails/initializable.rb:30:in `run'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.9/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `each'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.9/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.9/lib/rails/application.rb:136:in `initialize!'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/railties-3.2.9/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /var/www/beta.foerderapp.ch/releases/20140617123149/config/environment.rb:7:in `<top (required)>'
    from config.ru:4:in `require'
    from config.ru:4:in `block in <main>'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
    from config.ru:1:in `new'
    from config.ru:1:in `<main>'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/unicorn-4.6.3/lib/unicorn.rb:48:in `eval'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/unicorn-4.6.3/lib/unicorn.rb:48:in `block in builder'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/unicorn-4.6.3/bin/unicorn_rails:139:in `call'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/unicorn-4.6.3/bin/unicorn_rails:139:in `block in rails_builder'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:722:in `call'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:722:in `build_app!'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:140:in `start'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/gems/unicorn-4.6.3/bin/unicorn_rails:209:in `<top (required)>'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/bin/unicorn_rails:23:in `load'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/bin/unicorn_rails:23:in `<main>'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval'
    from /home/luzi/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `<main>'

非常感谢任何帮助。谢谢!

更新

安装了redis gem:

Using rake 10.3.2
Using i18n 0.6.9
Using multi_json 1.10.1
Using activesupport 3.2.9
Using builder 3.0.4
Using activemodel 3.2.9
Using erubis 2.7.0
Using journey 1.0.4
Using rack 1.4.5
Using rack-cache 1.2
Using rack-test 0.6.2
Using hike 1.2.3
Using tilt 1.4.1
Using sprockets 2.2.2
Using actionpack 3.2.9
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.4.4
Using actionmailer 3.2.9
Using active_model_serializers 0.8.1
Using arel 3.0.3
Using tzinfo 0.3.39
Using activerecord 3.2.9
Using activeresource 3.2.9
Using rack-ssl 1.3.4
Using json 1.8.1
Using rdoc 3.12.2
Using thor 0.19.1
Using railties 3.2.9
Using sass 3.3.8
Using anjlab-bootstrap-rails 3.0.0.3
Using annotate 2.5.0
Using handlebars-source 1.3.0
Using ember-source 1.6.0.beta.5
Using execjs 2.2.0
Using barber 0.4.2
Using bcrypt-ruby 3.0.1
Using colorize 0.7.3
Using net-ssh 2.9.1
Using net-scp 1.2.1
Using sshkit 1.5.1
Using capistrano 3.1.0 from git://github.com/lulezi/capistrano.git (at fix-head-unless-master)
Using coffee-script-source 1.7.0
Using coffee-script 2.2.0
Using coffee-rails 3.2.2
Using ember-data-source 1.0.0.beta.7
Using jquery-rails 3.1.0
Using ember-rails 0.15.0 from git://github.com/emberjs/ember-rails.git (at master)
Using god 0.13.4
Using kgio 2.9.2
Using libv8 3.16.14.3
Using mail_view 2.0.4 from https://github.com/37signals/mail_view.git (at master)
Using mysql2 0.3.16
Using newrelic_rpm 3.8.1.221
Using quiet_assets 1.0.2
Using bundler 1.6.2
Using rails 3.2.9
Using raindrops 0.13.0
Using redis 3.0.7
Using ref 1.0.5
Using sass-rails 3.2.6
Using sqlite3 1.3.9
Using therubyracer 0.12.1
Using turbo-sprockets-rails3 0.3.11
Using uglifier 2.5.1
Using unicorn 4.8.3
Using wicked_pdf 0.10.2
Using wkhtmltopdf-binary 0.9.9.3
Using yaml_db 0.2.3
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

1 个答案:

答案 0 :(得分:1)

我遇到了同样的错误,我通过将'redis.rb'更改为'test.rb'来解决这个问题。似乎文件名redis.rb与gem lib redis混淆。