mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Switch to using include? on validation callbacks
This commit is contained in:
parent
d66d6076b2
commit
60c65ca8df
1 changed files with 2 additions and 2 deletions
|
@ -57,7 +57,7 @@ module ActiveModel
|
|||
if options.is_a?(Hash) && options[:on]
|
||||
options[:if] = Array(options[:if])
|
||||
options[:on] = Array(options[:on])
|
||||
options[:if].unshift("self.validation_context.in? #{options[:on]}")
|
||||
options[:if].unshift("#{options[:on]}.include? self.validation_context")
|
||||
end
|
||||
set_callback(:validation, :before, *args, &block)
|
||||
end
|
||||
|
@ -95,7 +95,7 @@ module ActiveModel
|
|||
options[:if] = Array(options[:if])
|
||||
if options[:on]
|
||||
options[:on] = Array(options[:on])
|
||||
options[:if].unshift("self.validation_context.in? #{options[:on]}")
|
||||
options[:if].unshift("#{options[:on]}.include? self.validation_context")
|
||||
end
|
||||
set_callback(:validation, :after, *(args << options), &block)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue