diff --git a/lib/rocket_pants/controller/rescuable.rb b/lib/rocket_pants/controller/rescuable.rb index 1c9d9ac..d04562e 100644 --- a/lib/rocket_pants/controller/rescuable.rb +++ b/lib/rocket_pants/controller/rescuable.rb @@ -23,7 +23,13 @@ module Rescuable end }, :bugsnag => lambda { |controller, exception, request| - controller.send(:notify_bugsnag, exception, request: request) + if controller.respond_to?(:notify_bugsnag, true) + controller.send(:notify_bugsnag, exception, request: request) + else + # Bugsnag v6 removed #notify_bugsnag controller method + # Use #notify directly + Bugsnag.notify(exception) + end } } diff --git a/spec/rocket_pants/controller/error_handling_spec.rb b/spec/rocket_pants/controller/error_handling_spec.rb index 9563650..8d23c64 100644 --- a/spec/rocket_pants/controller/error_handling_spec.rb +++ b/spec/rocket_pants/controller/error_handling_spec.rb @@ -75,6 +75,9 @@ before :each do controller_class.use_named_exception_notifier :bugsnag stub.instance_of(controller_class).notify_bugsnag {} + Bugsnag = Class.new do + define_singleton_method(:notify) { |exception| } + end end it 'should send notification when it is the named exception notifier' do