Module: DataMapper::Validations::ValidatesPresence
- Extended by:
- Deprecate
- Included in:
- ClassMethods
- Defined in:
- lib/dm-validations/validators/required_field_validator.rb
Overview
class PresenceValidator
Instance Method Summary collapse
-
#validates_presence_of(*fields) ⇒ Object
Validates that the specified attribute is present.
Instance Method Details
#validates_presence_of(*fields) ⇒ Object
Note:
dm-core’s support lib adds the blank? method to many classes,
Validates that the specified attribute is present.
For most property types “being present” is the same as being “not blank” as determined by the attribute’s #blank? method. However, in the case of Boolean, “being present” means not nil; i.e. true or false.
76 77 78 |
# File 'lib/dm-validations/validators/required_field_validator.rb', line 76 def validates_presence_of(*fields) validators.add(PresenceValidator, *fields) end |