Module: ACH::Validations

Included in:
Component, Record::Base
Defined in:
lib/ach/validations.rb

Overview

This module hosts the most basic validations for both components and records. The only validation being performed is presence validation.

Instance Method Summary collapse

Instance Method Details

#errorsActiveSupport::OrderedHash

Return errors hash.



40
41
42
# File 'lib/ach/validations.rb', line 40

def errors
  @errors || reset_errors!
end

#valid?Boolean

Clear errors, validate object and return true if records are empty.



8
9
10
11
12
# File 'lib/ach/validations.rb', line 8

def valid?
  reset_errors!
  is_a?(Component) ? validate_as_component : validate_as_record
  errors.empty?
end