Browse files

Merge pull request #11196 from yangchenyun/remove_evals_in_am_callbacks

Remove evals from AM::Validations::Callbacks
  • Loading branch information...
2 parents 996f9b5 + 5fe43ff commit 9517aff899ef30ab8b5542b0483cd45fcd545a99 @carlosantoniodasilva carlosantoniodasilva committed Jun 30, 2013
Showing with 3 additions and 1 deletion.
  1. +3 −1 activemodel/lib/active_model/validations/callbacks.rb
View
4 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 9517aff

Please sign in to comment.