Module: DataMapper::Validate::ValidatesPresent
- Included in:
- ClassMethods
- Defined in:
- lib/gems/dm-validations-0.9.9/lib/dm-validations/required_field_validator.rb
Overview
class RequiredFieldValidator
Instance Method Summary collapse
-
#validates_present(*fields) ⇒ Object
Validates that the specified attribute is present.
Instance Method Details
#validates_present(*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.
81 82 83 84 |
# File 'lib/gems/dm-validations-0.9.9/lib/dm-validations/required_field_validator.rb', line 81 def validates_present(*fields) opts = opts_from_validator_args(fields) add_validator_to_context(opts, fields, DataMapper::Validate::RequiredFieldValidator) end |