Module: StrokeDB::Validations::InstanceMethods

Included in:
Document
Defined in:
lib/strokedb/document/dsl/validations.rb

Overview

this module gets mixed into Document

Defined Under Namespace

Classes: Errors

Instance Method Summary collapse

Instance Method Details

#errorsObject

Returns the Errors object that holds all information about attribute error messages.



512
513
514
# File 'lib/strokedb/document/dsl/validations.rb', line 512

def errors
  @errors ||= Errors.new(self)
end

#valid?Boolean

Runs validations and returns true if no errors were added otherwise false.

Returns:

  • (Boolean)


502
503
504
505
506
507
508
# File 'lib/strokedb/document/dsl/validations.rb', line 502

def valid?
  errors.clear
  
  execute_callbacks :on_validation

  errors.empty?
end