Method: Validatable::Macros#validates_true_for

Defined in:
lib/macros.rb

#validates_true_for(*args) ⇒ Object

call-seq: validates_true_for(*args)

Validates that the logic evaluates to true

class Person
  include Validatable
  validates_true_for :first_name, :logic => lambda { first_name == 'Jamie' }
end

The logic option is required.

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
* logic - A block that executes to perform the validation


193
194
195
# File 'lib/macros.rb', line 193

def validates_true_for(*args)
  add_validations(args, ValidatesTrueFor)
end