diff options
author | claudiob <claudiob@gmail.com> | 2014-12-08 06:53:24 -0800 |
---|---|---|
committer | claudiob <claudiob@gmail.com> | 2015-01-02 15:31:56 -0800 |
commit | 91b8129320522f664801f122daea4a7628db90a7 (patch) | |
tree | e567a67d852bec7519d9249f70c2983664c75459 /activemodel/lib | |
parent | f767981286b4c7dcb96e061a6f3edcc334008ea8 (diff) | |
download | rails-91b8129320522f664801f122daea4a7628db90a7.tar.gz rails-91b8129320522f664801f122daea4a7628db90a7.tar.bz2 rails-91b8129320522f664801f122daea4a7628db90a7.zip |
Deprecate `false` as the way to halt AM callbacks
Before this commit, returning `false` in an ActiveModel `before_` callback
such as `before_create` would halt the callback chain.
After this commit, the behavior is deprecated: will still work until
the next release of Rails but will also display a deprecation warning.
The preferred way to halt a callback chain is to explicitly `throw(:abort)`.
Diffstat (limited to 'activemodel/lib')
-rw-r--r-- | activemodel/lib/active_model/callbacks.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/callbacks.rb b/activemodel/lib/active_model/callbacks.rb index 061d96a80b..6214802074 100644 --- a/activemodel/lib/active_model/callbacks.rb +++ b/activemodel/lib/active_model/callbacks.rb @@ -6,7 +6,7 @@ module ActiveModel # Provides an interface for any class to have Active Record like callbacks. # # Like the Active Record methods, the callback chain is aborted as soon as - # one of the methods in the chain returns +false+. + # one of the methods throws +:abort+. # # First, extend ActiveModel::Callbacks from the class you are creating: # @@ -103,7 +103,6 @@ module ActiveModel def define_model_callbacks(*callbacks) options = callbacks.extract_options! options = { - terminator: ->(_,result_lambda) { result_lambda.call == false }, skip_after_callbacks_if_terminated: true, scope: [:kind, :name], only: [:before, :around, :after] |