Fix deprecation: returning false in Active Record and Active Model callbacks will not implicitly halt a callback chain

This commit is contained in:
Jasper Maes 2019-01-03 19:23:37 +01:00
parent 5a9808651b
commit d36b022fae
3 changed files with 7 additions and 4 deletions

View file

@ -54,6 +54,6 @@ class List < ActiveRecord::Base
private
def can_be_destroyed
destroyable?
throw(:abort) unless destroyable?
end
end

View file

@ -0,0 +1,6 @@
---
title: 'Fix deprecation: returning false in Active Record and Active Model callbacks
will not implicitly halt a callback chain'
merge_request: 24134
author: Jasper Maes
type: other

View file

@ -22,6 +22,3 @@ ActiveSupport.to_time_preserves_timezone = false
# Require `belongs_to` associations by default. Previous versions had false.
Rails.application.config.active_record.belongs_to_required_by_default = false
# Do not halt callback chains when a callback returns false. Previous versions had true.
ActiveSupport.halt_callback_chains_on_return_false = true