Class: FinancialTransactionType

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.defaultObject



18
19
20
# File 'app/models/financial_transaction_type.rb', line 18

def self.default
  first
end

.has_multiple_typesObject



22
23
24
# File 'app/models/financial_transaction_type.rb', line 22

def self.has_multiple_types
  count > 1
end

Instance Method Details

#restrict_deleting_last_financial_transaction_typeObject (protected)

check if this is the last financial transaction type and deny



29
30
31
# File 'app/models/financial_transaction_type.rb', line 29

def restrict_deleting_last_financial_transaction_type
  raise I18n.t('model.financial_transaction_type.no_delete_last') if FinancialTransactionType.count == 1
end