aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/lib/active_model/validations/callbacks.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activemodel/lib/active_model/validations/callbacks.rb')
-rw-r--r--activemodel/lib/active_model/validations/callbacks.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/validations/callbacks.rb b/activemodel/lib/active_model/validations/callbacks.rb
index e22d8a81c0..1a5192b0ff 100644
--- a/activemodel/lib/active_model/validations/callbacks.rb
+++ b/activemodel/lib/active_model/validations/callbacks.rb
@@ -58,7 +58,7 @@ module ActiveModel
if options.is_a?(Hash) && options[:on]
options[:if] = Array(options[:if])
options[:on] = Array(options[:on])
- options[:if].unshift lambda { |o|
+ options[:if].unshift ->(o) {
options[:on].include? o.validation_context
}
end
@@ -98,7 +98,9 @@ module ActiveModel
options[:if] = Array(options[:if])
if options[:on]
options[:on] = Array(options[:on])
- options[:if].unshift("#{options[:on]}.include? self.validation_context")
+ options[:if].unshift ->(o) {
+ options[:on].include? o.validation_context
+ }
end
set_callback(:validation, :after, *(args << options), &block)
end