From bb78af73ab7e86fd9662e8810e346b082a1ae193 Mon Sep 17 00:00:00 2001 From: claudiob Date: Sun, 14 Dec 2014 22:10:15 -0800 Subject: Deprecate `false` as the way to halt AR callbacks Before this commit, returning `false` in an ActiveRecord `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)`. --- activerecord/test/models/ship.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/test/models/ship.rb') diff --git a/activerecord/test/models/ship.rb b/activerecord/test/models/ship.rb index 5f618a50d2..c2f6d492d8 100644 --- a/activerecord/test/models/ship.rb +++ b/activerecord/test/models/ship.rb @@ -14,7 +14,7 @@ class Ship < ActiveRecord::Base attr_accessor :cancel_save_from_callback before_save :cancel_save_callback_method, :if => :cancel_save_from_callback def cancel_save_callback_method - false + throw(:abort) end end -- cgit v1.2.3