Class: WhyValidationsSuckIn96::ValidatesAcceptance
- Inherits:
-
Validation
- Object
- Validation
- WhyValidationsSuckIn96::ValidatesAcceptance
- Includes:
- AttributeBasedValidation, SkippableValidation
- Defined in:
- lib/whyvalidationssuckin96/macros/validates_acceptance.rb
Overview
Validates the acceptance of an attribute, such as the “I agree to the terms and conditions” checkbox value returned by a form post.
Constant Summary collapse
- DefaultOptions =
{:allow_nil => true, :accept => "1", :message => "must be accepted"}
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
24 25 26 27 28 29 30 31 |
# File 'lib/whyvalidationssuckin96/macros/validates_acceptance.rb', line 24 def validate super if [:accept] == attribute_value pass else fail end end |