Sha256: 722f96bc24b01e716602025670320b09f4981832f60578f9ee1afeaca10e879c

Contents?: true

Size: 567 Bytes

Versions: 1

Compression:

Stored size: 567 Bytes

Contents

class Unico::CreditorBankAccount < Unico::Model
  extend EnumerateIt

  self.abstract_class = true
  self.table_name = :unico_creditor_bank_accounts

  has_enumeration_for :status
  has_enumeration_for :account_type

  belongs_to :creditor, class_name: '::Creditor'
  belongs_to :agency, class_name: '::Agency'

  delegate :bank, :bank_id, to: :agency, allow_nil: true

  validates :creditor, :agency, :status, :account_type, :digit, presence: true
  validates :number, presence: true, uniqueness: { scope: :agency_id }

  def to_s
    "#{number}-#{digit}"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unico-training-7.8.0 app/models/unico/creditor_bank_account.rb