Method: Validation.validate

Defined in:
lib/yodel/models/core/validations/validation.rb

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



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/yodel/models/core/validations/validation.rb', line 4

def self.validate(type, params, field, name, value, record, errors)
  validation = case type
  when 'excluded_from'
    ExcludedFromValidation
  when 'excludes_combinations'
    ExcludesCombinationsValidation
  when 'format'
    FormatValidation
  when 'included_in'
    IncludedInValidation
  when 'includes_combinations'
    IncludesCombinationsValidation
  when 'length'
    LengthValidation
  when 'required'
    RequiredValidation
  when 'unique'
    UniqueValidation
  when 'password_confirmation'
    PasswordConfirmationValidation
  end
  validation.validate(params, field, name, value, record, errors)
end