Class: WhyValidationsSuckIn96::ValidatesConfirmation
- Inherits:
-
Validation
- Object
- Validation
- WhyValidationsSuckIn96::ValidatesConfirmation
- Includes:
- AttributeBasedValidation, SkippableValidation
- Defined in:
- lib/whyvalidationssuckin96/macros/validates_confirmation.rb
Overview
Checks the validity of an attribute against a confirmation field. Note that this validation does not set up the confirmation field on the object, leaving this up to the implementer.
Constant Summary collapse
- DefaultOptions =
{:message => "does not match the confirmation"}
Instance Attribute Summary
Attributes inherited from Validation
Instance Method Summary collapse
Methods included from AttributeBasedValidation
#attribute, #attribute_value, #initialize, #validates?
Methods inherited from Validation
#failed?, #has_run?, #initialize, #message, new_subclass, #passed?, #validates?
Instance Method Details
#validate ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/whyvalidationssuckin96/macros/validates_confirmation.rb', line 22 def validate super skip unless confirmation_value = validatable.send(confirmation_field) if confirmation_value == attribute_value pass else fail end end |