Module: Dinamo::Model::Validation

Extended by:
ActiveSupport::Concern
Included in:
Dinamo::Model
Defined in:
lib/dinamo/model/validator.rb,
lib/dinamo/model/validation.rb,
lib/dinamo/model/validations/presence.rb

Defined Under Namespace

Modules: ClassMethods Classes: EachValidator, PresenceValidator, Validator

Instance Method Summary collapse

Instance Method Details

#errorsObject



13
14
15
# File 'lib/dinamo/model/validation.rb', line 13

def errors
  @errors ||= Dinamo::Model::Errors.new
end

#valid?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/dinamo/model/validation.rb', line 9

def valid?
  validate
end

#validateObject



17
18
19
20
21
22
23
# File 'lib/dinamo/model/validation.rb', line 17

def validate
  errors.clear
  validate_unsupported_fields
  validate_required_attributes
  validate_by_using_validators
  errors.empty?
end