Peek因未初始化的常量错误而失败

时间:2015-03-31 13:17:15

标签: ruby-on-rails

为什么偷看宝石显示uninitialized constant Peek::Views::Mysql2 (NameError)。按照文档https://github.com/peek/peek中的步骤操作。 Addedmount Peek :: Railtie => ' / PEEK'

  root :to => 'home#show'   

Gem也存在于本地gemset中

config/initializers/peek.rb:1:in `<top (required)>': uninitialized constant Peek::Views::Mysql2 (NameError)
        from /home/pris/.rvm/gems/ruby-2.1.3@ybp/gems/railties-4.1.9/lib/rails/engine.rb:648:in `block in load_config_initializer'
        from /home/pris/.rvm/gems/ruby-2.1.3@ybp/gems/activesupport-4.1.9/lib/active_support/notifications.rb:161:in `instrument'
        from /home/pris/.rvm/gems/ruby-2.1.3@ybp/gems/railties-4.1.9/lib/rails/engine.rb:647:in `load_config_initializer'
        from /home/pris/.rvm/gems/ruby-2.1.3@ybp/gems/railties-4.1.9/lib/rails/engine.rb:612:in `block (2 levels) in <class:Engine>'
        from /home/pris/.rvm/gems/ruby-2.1.3@ybp/gems/railties-4.1.9/lib/rails/engine.rb:611:in `each'
        from /home/pris/.rvm/gems/ruby-2.1.3@ybp/gems/railties-4.1.9/lib/rails/engine.rb:611:in `block in <class:Engine>'
        from /home/pris/.rvm/gems/ruby-2.1.3@ybp/gems/railties-4.1.9/lib/rails/initializable.rb:30:in `instance_exec'
        from /home/pris/.rvm/gems/ruby-2.1.3@ybp/gems/railties-4.1.9/lib/rails/initializable.rb:30:in `run'
        from /home/pris/.rvm/gems/ruby-2.1.3@ybp/gems/railties-4.1.9/lib/rails/initializable.rb:55:in `block in run_initializers'

1 个答案:

答案 0 :(得分:0)

在Gemfile中添加peek-mysql2 gem

对于Peek.into ...文件中的每个config/initializers/peek.rb语句,都应包含corresponding gem containing the view files