2015-12-24 74 views
6

我正在運行我的rails應用程序,它一直工作得很好,直到昨天,但今天當我運行rails server時,它給了我這個錯誤。雖然我的airbrake也沒有任何錯誤
[airbrake.rb]Rails airbrake undefined方法

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 

從/home/techbirds/.rvm/gems/ruby-2.2.3/gem configure' from /home/techbirds/icare-master/config/initializers/airbrake.rb:1:in ' S /的ActiveSupport-4.2.5/LIB/active_support/dependencies.rb:268:在從/home/techbirds/.rvm/gems/ruby-2.2.3/gems/activesupport-

在負載」 load' from /home/techbirds/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/dependencies.rb:268:in

回答

15

它看起來像你已經無意中升級到new v5 Airbrake gem。您可以:

  1. 按照migration guide從空氣制動遷移V4到V5,或
  2. 鎖氣閘至V4,在Gemfile中,例如像gem 'airbrake', '~> 4.3.4'
+0

現在正在thx尋求幫助 –

1

您是否在github回購中檢查Migration guide

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

不工作得到同樣的錯誤未定義的方法'project_key」爲#述的遷移(NoMethodError) –

+0

SimpleConfig類/模塊與Airbrake無關。 – kyrylo

0

看來,你沒有在Gemfile這樣鎖定空氣制動的主要版本:

gem 'airbrake', '~> 4.3' 

5版本引入了你遇到API的變化。我建議使用上述版本鎖快速修復,然後執行如guide

相關問題