Module: CouchRest::Validation::ValidatesPresent
- Included in:
- ClassMethods
- Defined in:
- lib/couchrest/validation/validators/required_field_validator.rb
Overview
class RequiredFieldValidator
Instance Method Summary collapse
-
#validates_presence_of(*fields) ⇒ Object
Validates that the specified attribute is present.
- #validates_present(*fields) ⇒ Object
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.
102 103 104 105 |
# File 'lib/couchrest/validation/validators/required_field_validator.rb', line 102 def validates_presence_of(*fields) opts = opts_from_validator_args(fields) add_validator_to_context(opts, fields, CouchRest::Validation::RequiredFieldValidator) end |
#validates_present(*fields) ⇒ Object
107 108 109 110 |
# File 'lib/couchrest/validation/validators/required_field_validator.rb', line 107 def validates_present(*fields) warn "[DEPRECATION] `validates_present` is deprecated. Please use `validates_presence_of` instead." validates_presence_of(*fields) end |