Method: Validatable::Macros#validates_acceptance_of

Defined in:
lib/validatable/macros.rb

#validates_acceptance_of(*args) ⇒ Object

call-seq: validates_acceptance_of(*args)

Encapsulates the pattern of wanting to validate the acceptance of a terms of service check box (or similar agreement). Example:

class Person
  include Validatable
  validates_acceptance_of :terms_of_service
  validates_acceptance_of :eula, :message => "must be abided"
end

Configuration options:

* after_validate - A block that executes following the run of a validation
* message - The message to add to the errors collection when the validation fails
* times - The number of times the validation applies
* level - The level at which the validation should occur
* if - A block that when executed must return true of the validation will not occur
* group - The group that this validation belongs to.  A validation can belong to multiple groups


118
119
120
# File 'lib/validatable/macros.rb', line 118

def validates_acceptance_of(*args)
  add_validations(args, ValidatesAcceptanceOf)
end