Method: Validatable::Macros#validates_length_of
- Defined in:
- lib/validatable/macros.rb
#validates_length_of(*args) ⇒ Object
call-seq: validates_length_of(*args)
Validates that the specified attribute matches the length restrictions supplied.
class Person
include Validatable
validates_length_of :first_name, :maximum=>30
validates_length_of :last_name, :minimum=>30
end
Configuration options:
* after_validate - A block that executes following the run of a validation
* - The 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
* minimum - The minimum size of the attribute
* maximum - The maximum size of the attribute
* is - The size the attribute must be
* in - A range that the size of the attribute must fall in
* group - The group that this validation belongs to. A validation can belong to multiple groups
74 75 76 |
# File 'lib/validatable/macros.rb', line 74 def validates_length_of(*args) add_validations(args, ValidatesLengthOf) end |