Anand Kumar
Anand Kumar

Reputation: 227

airbrake notify_airbrake method not working in controller

In airbrake controller this code works (gives notification) rescue => ex Airbrake.notify but

rescue => ex
    notify_airbrake(ex)
end

Doesn't give a any airbrake notification.how to make notify_airbrake(ex) to work

Upvotes: 3

Views: 2879

Answers (2)

blindgaenger
blindgaenger

Reputation: 2080

The implementation of notify_airbrake ignores local request. So if you try to use this method in development you're out of luck. No matter what you've defined in your Airbrake config.

So you could set consider_all_requests_local = false, which is properly not what you want.

Instead you can use airbrake_request_data to get the same result if you don't want to pick the params by yourself.

rescue => ex
  Airbrake.notify(ex, airbrake_request_data)
  redirect_to root_url
end

Hope this helps!

Upvotes: 1

shime
shime

Reputation: 9008

You're probably testing that in your development environment. Add this to your airbrake.rb and it should work.

config.development_environments = []

Upvotes: 3

Related Questions