diff options
author | Brian Cardarella <bcardarella@gmail.com> | 2012-04-23 17:16:05 -0400 |
---|---|---|
committer | Brian Cardarella <bcardarella@gmail.com> | 2012-04-23 17:16:05 -0400 |
commit | fcc534ed76a7ef50bf7887378ce6c68d5ace336c (patch) | |
tree | f72015a8f17a81a669dd8530b1cebfa9e919cdda /activemodel/lib/active_model/validations | |
parent | 82c3aca17e78d25f217702e530586673f2a219d7 (diff) | |
download | rails-fcc534ed76a7ef50bf7887378ce6c68d5ace336c.tar.gz rails-fcc534ed76a7ef50bf7887378ce6c68d5ace336c.tar.bz2 rails-fcc534ed76a7ef50bf7887378ce6c68d5ace336c.zip |
confirmation validation error attribute
This will render the error message on :#{attribute}_confirmation instead
of on attribute itself. When rendering confirmation errors inline on the
form with form builders such as SimpleForm and Formtastic it is
confusing to the ender user to see the confirmation error message on the
attribute element. Instead it makes more sense to have this validation
error render on the confirmation field instead.
The i18n message has been updated for the confirmation validator error
message to include the original attribute name.
Diffstat (limited to 'activemodel/lib/active_model/validations')
-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 e8526303e2..011d1171b5 100644 --- a/activemodel/lib/active_model/validations/confirmation.rb +++ b/activemodel/lib/active_model/validations/confirmation.rb @@ -5,7 +5,7 @@ module ActiveModel class ConfirmationValidator < EachValidator def validate_each(record, attribute, value) if (confirmed = record.send("#{attribute}_confirmation")) && (value != confirmed) - record.errors.add(attribute, :confirmation, options) + record.errors.add(:"#{attribute}_confirmation", :confirmation, options.merge(:attribute => attribute)) end end |