Skip to content

Instantly share code, notes, and snippets.

@gdomingu
Last active December 12, 2019 17:11
Show Gist options
  • Save gdomingu/c9412447b9d00a449fc28cec9e7b1c01 to your computer and use it in GitHub Desktop.
Save gdomingu/c9412447b9d00a449fc28cec9e7b1c01 to your computer and use it in GitHub Desktop.
A handler for doing special things for deprecation notices in rails 5.0
ActiveSupport::Deprecation.behavior = ActiveSupport::Deprecation.behavior + [->(message, callstack) {
if message.include?("Returning `false` in Active Record and Active Model callbacks will not implicitly halt a callback chain in Rails 5.1. To explicitly halt the callback chain, please use `throw :abort` instead.")
DeprecationLogger.log("Callback returned false", { callstack: callstack})
end
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment