Class: FinancialLink

Inherits:
ApplicationRecord show all
Defined in:
app/models/financial_link.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.first_unused_or_createObject



37
38
39
# File 'app/models/financial_link.rb', line 37

def self.first_unused_or_create
  unused.first || create
end

Instance Method Details

#amountObject



41
42
43
# File 'app/models/financial_link.rb', line 41

def amount
  bank_transactions.sum(:amount) + invoices.sum(:amount) - financial_transactions.sum(:amount)
end