Sha256: fefe6e96b9f6fba80737aa3017f86747b438462abdd5079a2becab06bcb31baa
Contents?: true
Size: 759 Bytes
Versions: 1
Compression:
Stored size: 759 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: :borutus_amounts_count, }) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
borutus-0.2.2 | app/models/borutus/amount.rb |