Module: ZohoHub::WithValidations::ClassMethods
- Defined in:
- lib/zoho_hub/with_validations.rb
Instance Method Summary collapse
Instance Method Details
#add_validation(field, params = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/zoho_hub/with_validations.rb', line 13 def add_validation(field, params = {}) @validations ||= [] = params.dup validate = .delete(:validate) unless validate raise ArgumentError, 'You must provide the validation with the `validate` key!' end @validations << { field: field, validate: validate }.merge() end |
#validations ⇒ Object
26 27 28 |
# File 'lib/zoho_hub/with_validations.rb', line 26 def validations @validations || [] end |