Permalink
Browse files

remove evals from AM::Validations::Callbacks

follow the same refactor at a63a964
  • Loading branch information...
1 parent 4eedb39 commit 5fe43ffcfb123b838f48c0775bcd3bf4fc1b8b73 @yangchenyun yangchenyun committed Jun 30, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 activemodel/lib/active_model/validations/callbacks.rb
@@ -58,7 +58,9 @@ def before_validation(*args, &block)
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

0 comments on commit 5fe43ff

Please sign in to comment.