mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 03:54:08 +00:00
The Account model only delegated the subtype reader to the accountable, but not the writer. This caused form submissions with `account[subtype]` to be silently ignored since there was no setter method on Account. Changes: - Add `subtype=` writer method to Account that delegates to accountable - Add additional investment subtypes (457b, sep_ira, simple_ira, trust, ugma, utma, other) to Investment::SUBTYPES for better coverage - Update PlaidAccount::TypeMappable with additional investment subtype mappings (403b, 457b, sep_ira, simple_ira, trust, ugma, utma) Fixes #502 Co-authored-by: Claude <noreply@anthropic.com>
41 lines
1.3 KiB
Ruby
41 lines
1.3 KiB
Ruby
class Investment < ApplicationRecord
|
|
include Accountable
|
|
|
|
SUBTYPES = {
|
|
"brokerage" => { short: "Brokerage", long: "Brokerage" },
|
|
"pension" => { short: "Pension", long: "Pension" },
|
|
"retirement" => { short: "Retirement", long: "Retirement" },
|
|
"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" },
|
|
"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
|
|
def color
|
|
"#1570EF"
|
|
end
|
|
|
|
def classification
|
|
"asset"
|
|
end
|
|
|
|
def icon
|
|
"chart-line"
|
|
end
|
|
end
|
|
end
|