Sha256: 6f49e017a37250bf2e71abbc0fae0b43e41670530f025ba4722bcf365a5986cb

Contents?: true

Size: 620 Bytes

Versions: 3

Compression:

Stored size: 620 Bytes

Contents

module Credere
  # The Amount class represents debit and credit amounts in the system.
  #
  # @abstract
  #   An amount must be a subclass as either a debit or a credit to be saved to the database.
  #

  class Amount < ActiveRecord::Base
    belongs_to :entry, :class_name => 'Credere::Entry'
    belongs_to :account, :class_name => 'Credere::Account'

    validates_presence_of :type, :amount, :entry, :account
    # attr_accessible :account, :account_name, :amount, :entry

    # Assign an account by name
    def account_name=(name)
      self.account = Account.find_by_name!(name)
    end

    protected
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
credere-0.10.3 app/models/credere/amount.rb
credere-0.10.2 app/models/credere/amount.rb
credere-0.10.1 app/models/credere/amount.rb