Rails airbrake undefined方法

时间:2015-12-24 09:30:33

标签: ruby-on-rails airbrake

我正在运行我的rails应用程序,它工作正常,直到昨天,但今天当我运行rails服务器它给了我这个错误。虽然我的空气制动器也没有任何错误
[airbrake.rb]

Airbrake.configure do |config|
  config.api_key = APP_CONFIG.airbrake.api_key
  config.host    = APP_CONFIG.airbrake.host
  config.port    = APP_CONFIG.airbrake.port
  config.secure  = config.port == 443
end


undefined method `api_key=' for #<Airbrake::Config:0x000000073fa1e0> (NoMethodError)
  from /home/techbirds/.rvm/gems/ruby-2.2.3/gems/airbrake-ruby-1.0.0/lib/airbrake-ruby.rb:98:in
     

configure' from /home/techbirds/icare-master/config/initializers/airbrake.rb:1:in ”         来自/home/techbirds/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in load' from /home/techbirds/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in阻止加载'         来自/home/techbirds/.rvm/gems/ruby-2.2.3/gems/activesupport -

3 个答案:

答案 0 :(得分:16)

看起来你无意中升级到了new v5 Airbrake gem。你可以:

  1. 按照migration guide从airbrake v4迁移到v5或
  2. 将空气制动器锁定到宝石文件中的v4,例如像gem 'airbrake', '~> 4.3.4'
  3. 之类的东西

答案 1 :(得分:1)

您是否检查了github回购中的Migration guide

Old option | New option  | required?
api_key    | project_key | required
.......    | ........... | ........

答案 2 :(得分:0)

您似乎没有像Gemfile这样锁定Airbrake的主要版本:

gem 'airbrake', '~> 4.3'

第5版介绍了您遇到的api更改。我建议使用上面的版本锁进行快速修复,然后按guide

中的描述进行迁移