From fb39ce597483398bcccb6985f5f627ff02e8863a Mon Sep 17 00:00:00 2001 From: fabioelia Date: Sat, 26 Jan 2013 10:37:07 -0500 Subject: [PATCH] Fix for yesturdays bad code --- app/models/plutus/account.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/plutus/account.rb b/app/models/plutus/account.rb index c1c12a0f..03510e39 100644 --- a/app/models/plutus/account.rb +++ b/app/models/plutus/account.rb @@ -42,11 +42,11 @@ class Account < ActiveRecord::Base validates_uniqueness_of :name def credits_by_date(start_date = "1900-01-01", end_date = Date.today + 15.days) - self.credit_amounts.includes(:transaction).where("plutus_transactions.date >= '#{start_date}' AND DATE( plutus_transactions.date) <= '#{end_date.to_s}'") + credit_amounts.includes(:transaction).where("plutus_transactions.date >= '#{start_date}' AND DATE( plutus_transactions.date) <= '#{end_date.to_s}'") end def debits_by_date(start_date = "1900-01-01", end_date = Date.today + 15.days) - self.debit_amounts.includes(:transaction).where("plutus_transactions.date >= '#{start_date}' AND DATE( plutus_transactions.date ) <= '#{end_date.to_s}'") + debit_amounts.includes(:transaction).where("plutus_transactions.date >= '#{start_date}' AND DATE( plutus_transactions.date ) <= '#{end_date.to_s}'") end # The trial balance of all accounts in the system. This should always equal zero, @@ -58,7 +58,7 @@ def debits_by_date(start_date = "1900-01-01", end_date = Date.today + 15.days) # # @return [BigDecimal] The decimal value balance of all accounts def self.trial_balance(startDate = nil, endDate = nil) - unless self.new.class == Account + if self.new.class != Account raise(NoMethodError, "undefined method 'trial_balance'") elsif startDate || endDate Asset.balance( startDate, endDate ) - (Liability.balance( startDate, endDate ) + Equity.balance( startDate, endDate ) + Revenue.balance( startDate, endDate ) - Expense.balance( startDate, endDate ))