Class: DataValidator::PresenceValidator
- Inherits:
-
BaseValidator
- Object
- BaseValidator
- DataValidator::PresenceValidator
- Defined in:
- lib/validations/presence.rb
Instance Attribute Summary
Attributes inherited from BaseValidator
#errors, #name, #options, #value
Instance Method Summary collapse
Methods inherited from BaseValidator
#add_error, #check_validity!, #initialize
Constructor Details
This class inherits a constructor from DataValidator::BaseValidator
Instance Method Details
#validate ⇒ Object
5 6 7 8 9 |
# File 'lib/validations/presence.rb', line 5 def validate if && (value.nil? || value.blank?) add_error :blank end end |