mirror of
https://github.com/we-promise/sure.git
synced 2026-04-20 20:44:08 +00:00
Merge branch 'main' of https://github.com/maybe-finance/maybe
This commit is contained in:
@@ -33,8 +33,10 @@ class AccountsController < ApplicationController
|
||||
end
|
||||
|
||||
def account_type_class
|
||||
params[:type].constantize
|
||||
rescue
|
||||
Account # Default to Account if type is not provided or invalid
|
||||
if params[:type].present? && Account::VALID_ACCOUNT_TYPES.include?(params[:type])
|
||||
params[:type].constantizes
|
||||
else
|
||||
Account # Default to Account if type is not provided or invalid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,4 +2,5 @@ class Account < ApplicationRecord
|
||||
belongs_to :family
|
||||
|
||||
scope :depository, -> { where(type: 'Depository') }
|
||||
VALID_ACCOUNT_TYPES = %w[Investment Depository Credit Loan Property Vehicle OtherAsset OtherLiability].freeze
|
||||
end
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
class Depository < Account
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user