aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel
diff options
context:
space:
mode:
authorJohn Foley <john@thefol.io>2012-07-02 19:23:34 -0600
committerJohn Foley <john@thefol.io>2012-09-23 12:53:50 -0600
commit60c65ca8dfc197b83f3b74b7e6ddeede005d416b (patch)
treec75ea42de3ec8afc2f0c718433aaaad7a5cd59f0 /activemodel
parentd66d6076b2a723c72d97fb8e8f90d83249f9bfe5 (diff)
downloadrails-60c65ca8dfc197b83f3b74b7e6ddeede005d416b.tar.gz
rails-60c65ca8dfc197b83f3b74b7e6ddeede005d416b.tar.bz2
rails-60c65ca8dfc197b83f3b74b7e6ddeede005d416b.zip
Switch to using include? on validation callbacks
Diffstat (limited to 'activemodel')
-rw-r--r--activemodel/lib/active_model/validations/callbacks.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activemodel/lib/active_model/validations/callbacks.rb b/activemodel/lib/active_model/validations/callbacks.rb
index c59babd831..c153ef4309 100644
--- a/activemodel/lib/active_model/validations/callbacks.rb
+++ b/activemodel/lib/active_model/validations/callbacks.rb
@@ -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