mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-20 13:49:39 +02:00
14 lines
520 B
Ruby
14 lines
520 B
Ruby
class Account < ApplicationRecord
|
|
belongs_to :family
|
|
|
|
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
|
|
|
|
# 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
|
|
end
|