Class: FinancialTransactionType
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- FinancialTransactionType
- Defined in:
- app/models/financial_transaction_type.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#restrict_deleting_last_financial_transaction_type ⇒ Object
protected
check if this is the last financial transaction type and deny.
Class Method Details
.default ⇒ Object
18 19 20 |
# File 'app/models/financial_transaction_type.rb', line 18 def self.default first end |
.has_multiple_types ⇒ Object
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_type ⇒ Object (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 |