aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2013-05-14 16:03:09 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2013-05-14 16:03:09 -0700
commitba552764344bc0a3c25b8576ec11f127ceaa16da (patch)
treee78fb72f5ca735e1e4c0956d79960761fff4f942 /activemodel
parent4c628e48a56920877948bd9d69d3e3caa41b5da8 (diff)
downloadrails-ba552764344bc0a3c25b8576ec11f127ceaa16da.tar.gz
rails-ba552764344bc0a3c25b8576ec11f127ceaa16da.tar.bz2
rails-ba552764344bc0a3c25b8576ec11f127ceaa16da.zip
deprecating string based terminators
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/callbacks.rb2
-rw-r--r--activemodel/lib/active_model/validations/callbacks.rb5
2 files changed, 5 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/callbacks.rb b/activemodel/lib/active_model/callbacks.rb
index 94d2181e4d..8b09f8b203 100644
--- a/activemodel/lib/active_model/callbacks.rb
+++ b/activemodel/lib/active_model/callbacks.rb
@@ -100,7 +100,7 @@ module ActiveModel
def define_model_callbacks(*callbacks)
options = callbacks.extract_options!
options = {
- terminator: "result == false",
+ terminator: ->(_,result) { result == false },
skip_after_callbacks_if_terminated: true,
scope: [:kind, :name],
only: [:before, :around, :after]
diff --git a/activemodel/lib/active_model/validations/callbacks.rb b/activemodel/lib/active_model/validations/callbacks.rb
index 8de36b4f8b..cabb9482f2 100644
--- a/activemodel/lib/active_model/validations/callbacks.rb
+++ b/activemodel/lib/active_model/validations/callbacks.rb
@@ -22,7 +22,10 @@ module ActiveModel
included do
include ActiveSupport::Callbacks
- define_callbacks :validation, terminator: "result == false", skip_after_callbacks_if_terminated: true, scope: [:kind, :name]
+ define_callbacks :validation,
+ terminator: ->(_,result) { result == false },
+ skip_after_callbacks_if_terminated: true,
+ scope: [:kind, :name]
end
module ClassMethods