Class: ZohoHub::Validations::ValidateLength
- Inherits:
-
BaseValidation
- Object
- BaseValidation
- ZohoHub::Validations::ValidateLength
- Defined in:
- lib/zoho_hub/validations/validate_length.rb
Instance Attribute Summary
Attributes inherited from BaseValidation
Instance Method Summary collapse
Methods inherited from BaseValidation
Constructor Details
This class inherits a constructor from ZohoHub::Validations::BaseValidation
Instance Method Details
#validate(options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/zoho_hub/validations/validate_length.rb', line 8 def validate( = {}) value = record.send(field) return unless value return if value.size <= [:length] record.add_error(field, 'is too long') end |