diff --git a/app/models/account.rb b/app/models/account.rb index b861302c4..305cc1fd0 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -41,6 +41,12 @@ class Account < ApplicationRecord delegated_type :accountable, types: Accountable::TYPES, dependent: :destroy delegate :subtype, to: :accountable, allow_nil: true + # Writer for subtype that delegates to the accountable + # This allows forms to set subtype directly on the account + def subtype=(value) + accountable&.subtype = value + end + accepts_nested_attributes_for :accountable, update_only: true # Account state machine diff --git a/app/models/investment.rb b/app/models/investment.rb index ba4ecb169..f8b44e8b9 100644 --- a/app/models/investment.rb +++ b/app/models/investment.rb @@ -8,13 +8,20 @@ class Investment < ApplicationRecord "401k" => { short: "401(k)", long: "401(k)" }, "roth_401k" => { short: "Roth 401(k)", long: "Roth 401(k)" }, "403b" => { short: "403(b)", long: "403(b)" }, + "457b" => { short: "457(b)", long: "457(b)" }, "tsp" => { short: "TSP", long: "Thrift Savings Plan" }, "529_plan" => { short: "529 Plan", long: "529 Plan" }, "hsa" => { short: "HSA", long: "Health Savings Account" }, "mutual_fund" => { short: "Mutual Fund", long: "Mutual Fund" }, "ira" => { short: "IRA", long: "Traditional IRA" }, "roth_ira" => { short: "Roth IRA", long: "Roth IRA" }, - "angel" => { short: "Angel", long: "Angel" } + "sep_ira" => { short: "SEP IRA", long: "SEP IRA" }, + "simple_ira" => { short: "SIMPLE IRA", long: "SIMPLE IRA" }, + "angel" => { short: "Angel", long: "Angel" }, + "trust" => { short: "Trust", long: "Trust" }, + "ugma" => { short: "UGMA", long: "UGMA" }, + "utma" => { short: "UTMA", long: "UTMA" }, + "other" => { short: "Other", long: "Other Investment" } }.freeze class << self diff --git a/app/models/plaid_account/type_mappable.rb b/app/models/plaid_account/type_mappable.rb index e91b66d89..1142557b2 100644 --- a/app/models/plaid_account/type_mappable.rb +++ b/app/models/plaid_account/type_mappable.rb @@ -62,11 +62,18 @@ module PlaidAccount::TypeMappable "retirement" => "retirement", "401k" => "401k", "roth 401k" => "roth_401k", + "403b" => "403b", + "457b" => "457b", "529" => "529_plan", "hsa" => "hsa", "mutual fund" => "mutual_fund", "roth" => "roth_ira", - "ira" => "ira" + "ira" => "ira", + "sep ira" => "sep_ira", + "simple ira" => "simple_ira", + "trust" => "trust", + "ugma" => "ugma", + "utma" => "utma" } }, other: {