diff options
author | John Foley <john@thefol.io> | 2012-07-02 19:23:34 -0600 |
---|---|---|
committer | John Foley <john@thefol.io> | 2012-09-23 12:53:50 -0600 |
commit | 60c65ca8dfc197b83f3b74b7e6ddeede005d416b (patch) | |
tree | c75ea42de3ec8afc2f0c718433aaaad7a5cd59f0 /activemodel | |
parent | d66d6076b2a723c72d97fb8e8f90d83249f9bfe5 (diff) | |
download | rails-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.rb | 4 |
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 |