Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #11196 from yangchenyun/remove_evals_in_am_callbacks

Remove evals from AM::Validations::Callbacks
  • Loading branch information...
commit 9517aff899ef30ab8b5542b0483cd45fcd545a99 2 parents 996f9b5 + 5fe43ff
@carlosantoniodasilva carlosantoniodasilva authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.