Sha256: 9c4b76b1d5d4e4dcb13346d7a52a9d9157dcb980d386705049a565f4cefe36ca
Contents?: true
Size: 741 Bytes
Versions: 3
Compression:
Stored size: 741 Bytes
Contents
module Borutus # 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: "Borutus::Entry" belongs_to(:account, { class_name: "Borutus::Account", counter_cache: true, }) 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 end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
borutus-1.0.0 | app/models/borutus/amount.rb |
borutus-0.2.4 | app/models/borutus/amount.rb |
borutus-0.2.3 | app/models/borutus/amount.rb |