Add reference_calculator

This commit is contained in:
Patrick Gansterer 2019-11-11 12:09:18 +01:00
parent d75b881318
commit e16f03eebf
11 changed files with 133 additions and 1 deletions

View file

@ -1,5 +1,6 @@
class FinancialTransactionType < ApplicationRecord
belongs_to :financial_transaction_class
belongs_to :bank_account
has_many :financial_transactions, dependent: :restrict_with_exception
validates :name, presence: true
@ -10,6 +11,8 @@ class FinancialTransactionType < ApplicationRecord
before_destroy :restrict_deleting_last_financial_transaction_type
scope :with_name_short, -> { where.not(name_short: [nil, '']) }
def self.default
first
end