Class: Plutus::Entry

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/plutus/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 its credit or debit entries

Examples:

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

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

entry = Plutus::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/plutus/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/plutus/entry.rb', line 50

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