Sha256: 6ae807cbea38c0b5e7536b06c2f0ec3f5e66bcff6871f3a711f19d63062e1d9a

Contents?: true

Size: 707 Bytes

Versions: 5

Compression:

Stored size: 707 Bytes

Contents

module Plutus
  # 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.
  #
  # @author Michael Bulat
  class Amount < ActiveRecord::Base
    belongs_to :entry, :class_name => 'Plutus::Entry'
    belongs_to :account, :class_name => 'Plutus::Account'

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

    delegate :name, to: :account, prefix: true, allow_nil: true

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

    protected
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
plutus-0.17 app/models/plutus/amount.rb
plutus-0.16 app/models/plutus/amount.rb
plutus-0.15 app/models/plutus/amount.rb
plutus-0.14 app/models/plutus/amount.rb
tyche-0.14 app/models/plutus/amount.rb