diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-11-06 18:13:37 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-06 18:13:37 -0500 |
commit | 9042ced124874a200b134ec3a4441ab6e2c1be73 (patch) | |
tree | 5e1e5f4f8cb017a689742b741ee1b593a1ce5f07 /activemodel/lib/active_model/validations/confirmation.rb | |
parent | 165d5b601d44495452dcebba5a61b31b3be36da7 (diff) | |
parent | 7308991630af3fb8a2a7e2cde9fd322316153ec2 (diff) | |
download | rails-9042ced124874a200b134ec3a4441ab6e2c1be73.tar.gz rails-9042ced124874a200b134ec3a4441ab6e2c1be73.tar.bz2 rails-9042ced124874a200b134ec3a4441ab6e2c1be73.zip |
Merge pull request #31058 from bogdanvlviv/ConfirmationValidator-with_false_value
Execute `ConfirmationValidator` validation when `_confirmation`'s value is `false`
Diffstat (limited to 'activemodel/lib/active_model/validations/confirmation.rb')
-rw-r--r-- | activemodel/lib/active_model/validations/confirmation.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/validations/confirmation.rb b/activemodel/lib/active_model/validations/confirmation.rb index 0abec56b68..1b5d5b09ab 100644 --- a/activemodel/lib/active_model/validations/confirmation.rb +++ b/activemodel/lib/active_model/validations/confirmation.rb @@ -9,7 +9,7 @@ module ActiveModel end def validate_each(record, attribute, value) - if (confirmed = record.send("#{attribute}_confirmation")) + unless (confirmed = record.send("#{attribute}_confirmation")).nil? unless confirmation_value_equal?(record, attribute, value, confirmed) human_attribute_name = record.class.human_attribute_name(attribute) record.errors.add(:"#{attribute}_confirmation", :confirmation, options.except(:case_sensitive).merge!(attribute: human_attribute_name)) |