From 5fe43ffcfb123b838f48c0775bcd3bf4fc1b8b73 Mon Sep 17 00:00:00 2001 From: Steven Yang Date: Sun, 30 Jun 2013 18:47:55 +0800 Subject: [PATCH] remove evals from AM::Validations::Callbacks follow the same refactor at a63a964a5d1ed02cf0df1b1a33a96ed2a9fa987b --- activemodel/lib/active_model/validations/callbacks.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/activemodel/lib/active_model/validations/callbacks.rb b/activemodel/lib/active_model/validations/callbacks.rb index cabb9482f2..fde53b9f89 100644 --- a/activemodel/lib/active_model/validations/callbacks.rb +++ b/activemodel/lib/active_model/validations/callbacks.rb @@ -58,7 +58,9 @@ module ActiveModel if options.is_a?(Hash) && options[:on] options[:if] = Array(options[:if]) options[:on] = Array(options[:on]) - options[:if].unshift("#{options[:on]}.include? self.validation_context") + options[:if].unshift lambda { |o| + options[:on].include? o.validation_context + } end set_callback(:validation, :before, *args, &block) end