From 60c65ca8dfc197b83f3b74b7e6ddeede005d416b Mon Sep 17 00:00:00 2001 From: John Foley Date: Mon, 2 Jul 2012 19:23:34 -0600 Subject: Switch to using include? on validation callbacks --- activemodel/lib/active_model/validations/callbacks.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activemodel') 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 -- cgit v1.2.3