remove evals from AM::Validations::Callbacks

follow the same refactor at a63a964a5d
This commit is contained in:
Steven Yang 2013-06-30 18:47:55 +08:00
parent 4eedb3928e
commit 5fe43ffcfb
1 changed files with 3 additions and 1 deletions

View File

@ -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