ruby-on-railsairbrake

Why should controllers use notify_airbrake over Airbrake.notify


In the Airbrake wiki, it says to use notify_airbrake in controllers instead of Airbrake.notify, but doesn't explain why. What is the benefit of using notify_airbrake in controllers and why should it not be used elsewhere?


Solution

  • notify_airbrake is just a helper method. You don't have to use it (feel free to use Airbrake.notify). However notify_airbrake attaches extra information to the notice (like current user, session, Rack environment, etc). With Airbrake.notify you will only send what you pass to the method.