Class: RequiredValidation

Inherits:
Validation show all
Defined in:
lib/yodel/models/core/validations/required_validation.rb

Instance Attribute Summary

Attributes inherited from Validation

#field, #params

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Validation

#initialize, #to_json

Constructor Details

This class inherits a constructor from Validation

Class Method Details

.validate(params, field, name, value, record, errors) ⇒ Object



2
3
4
# File 'lib/yodel/models/core/validations/required_validation.rb', line 2

def self.validate(params, field, name, value, record, errors)
  errors[field.name] << new(params) if (value.blank? && !value.is_a?(FalseClass))
end

Instance Method Details

#describeObject



6
7
8
# File 'lib/yodel/models/core/validations/required_validation.rb', line 6

def describe
  "is required"
end