Class: Transaction

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

Overview

Transactions 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 transactions

Examples:

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

Transaction.create(:description => "Receiving payment on an invoice" , 
                   :debit_account => cash, 
                   :credit_account => accounts_receivable, 
                   :amount => 1000)

See Also:

Author: