1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-20 21:59:38 +02:00
Maybe/app/models/account.rb

15 lines
520 B
Ruby
Raw Normal View History

2024-02-02 09:05:04 -06:00
class Account < ApplicationRecord
belongs_to :family
2024-02-02 11:09:31 -06:00
2024-02-02 23:06:29 +00:00
delegated_type :accountable, types: %w[ Account::Credit Account::Depository Account::Investment Account::Loan Account::OtherAsset Account::OtherLiability Account::Property Account::Vehicle], dependent: :destroy
delegate :icon, :type_name, :color, to: :accountable
2024-02-02 23:09:35 +00:00
2024-02-02 23:06:29 +00:00
# Class method to get a representative instance of each accountable type
def self.accountable_type_instances
accountable_types.map do |type|
type.constantize.new
end
end
2024-02-02 09:05:04 -06:00
end