diff options
Diffstat (limited to 'activemodel/lib/active_model')
-rw-r--r-- | activemodel/lib/active_model/validations/confirmation.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activemodel/lib/active_model/validations/confirmation.rb b/activemodel/lib/active_model/validations/confirmation.rb index a31966d0c2..2c8a840124 100644 --- a/activemodel/lib/active_model/validations/confirmation.rb +++ b/activemodel/lib/active_model/validations/confirmation.rb @@ -4,9 +4,9 @@ module ActiveModel module Validations class ConfirmationValidator < EachValidator def validate_each(record, attribute, value) - confirmed = record.send(:"#{attribute}_confirmation") - return if confirmed.nil? || value == confirmed - record.errors.add(attribute, :confirmation, options) + if (confirmed = record.send("#{attribute}_confirmation")) && (value != confirmed) + record.errors.add(attribute, :confirmation, options) + end end def setup(klass) |