diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index da78a0e05748200e2c2171b2829fa045fda23f5f..37585b8c4699205e23f0c72a363b8788eddaaeac 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,3 +1,7 @@ +* Deprecate `.halt_and_display_warning_on_return_false`. + + *Rafael Mendonça França* + * Remove deprecated behavior that halts callbacks when the return is false. *Rafael Mendonça França* diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb index 2449cb06d80dda5b4dea07688ab5327c07031074..480291c346c180815b8d6c1b5fcfc2a9f22e49d0 100644 --- a/activesupport/lib/active_support/callbacks.rb +++ b/activesupport/lib/active_support/callbacks.rb @@ -69,11 +69,18 @@ module Callbacks CALLBACK_FILTER_TYPES = [:before, :after, :around] - # If true, Active Record and Active Model callbacks returning +false+ will - # halt the entire callback chain and display a deprecation message. - # If false, callback chains will only be halted by calling +throw :abort+. - # Defaults to +true+. - mattr_accessor(:halt_and_display_warning_on_return_false, instance_writer: false) { true } + def self.halt_and_display_warning_on_return_false=(value) + + ActiveSupport::Deprecation.warn(<<-MSG.squish) + .halt_and_display_warning_on_return_false= is deprecated and will be removed in Rails 5.2. + MSG + end + + def self.halt_and_display_warning_on_return_false + ActiveSupport::Deprecation.warn(<<-MSG.squish) + .halt_and_display_warning_on_return_false is deprecated and will be removed in Rails 5.2. + MSG + end # Runs the callbacks for the given event. #