Method: Modelish::Validations#validate

Defined in:
lib/modelish/validations.rb

#validateHash<Symbol,Array>

Validates all properties based on configured validators.

Returns:

  • (Hash<Symbol,Array>)

    map of errors where key is the property name and value is the list of errors

See Also:



17
18
19
20
21
22
23
24
25
26
# File 'lib/modelish/validations.rb', line 17

def validate
  errors = {}

  call_validators do |name, message|
    errors[name] ||= []
    errors[name] << to_error(message)
  end

  errors
end