Class: Borutus::Entry

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/borutus/entry.rb

Overview

Entries are the recording of debits and credits to various accounts. This table can be thought of as a traditional accounting Journal.

Posting to a Ledger can be considered to happen automatically, since Accounts have the reverse ‘has_many’ relationship to either it’s credit or debit entries

Examples:

cash = Borutus::Asset.find_by_name('Cash')
accounts_receivable = Borutus::Asset.find_by_name('Accounts Receivable')

debit_amount = Borutus::DebitAmount.new(:account => cash, :amount => 1000)
credit_amount = Borutus::CreditAmount.new(:account => accounts_receivable, :amount => 1000)

entry = Borutus::Entry.new(:description => "Receiving payment on an invoice")
entry.debit_amounts << debit_amount
entry.credit_amounts << credit_amount
entry.save

See Also:

Author:

  • Michael Bulat

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Entry

Returns a new instance of Entry.



55
56
57
# File 'app/models/borutus/entry.rb', line 55

def initialize(*args)
  super
end

Class Method Details

.build(hash) ⇒ Object

Support the deprecated .build method



50
51
52
53
# File 'app/models/borutus/entry.rb', line 50

def self.build(hash)
  ActiveSupport::Deprecation.warn('Borutus::Transaction.build() is deprecated (use new instead)', caller)
  new(hash)
end