Class: Toolchain::Validations::Validators::Confirmation
- Defined in:
- lib/toolchain/validations/validators/confirmation.rb
Overview
Validates the confirmation of an attribute. In the example both ‘password` and `password_confirmation` attributes must match. One or more `nil` values will result in the validation error being triggered as well.
Instance Attribute Summary
Attributes inherited from Base
#data, #errors, #key_path, #message, #object
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Toolchain::Validations::Validators::Base
Instance Method Details
#validate ⇒ Object
17 18 19 20 21 |
# File 'lib/toolchain/validations/validators/confirmation.rb', line 17 def validate if no_match? errors.add(key_path, || "doesn't match confirmation") end end |