Class: FinancialTransactionType

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/financial_transaction_type.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.defaultObject


12
13
14
# File 'app/models/financial_transaction_type.rb', line 12

def self.default
  first
end

.has_multiple_typesObject


16
17
18
# File 'app/models/financial_transaction_type.rb', line 16

def self.has_multiple_types
  self.count > 1
end

Instance Method Details

#restrict_deleting_last_financial_transaction_typeObject (protected)

check if this is the last financial transaction type and deny


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

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