1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-24 15:49:39 +02:00

Attempt name override (#2244)

This commit is contained in:
Alex Hatzenbuhler 2025-05-16 10:23:57 -05:00 committed by GitHub
parent 9155e737b2
commit 5efa8268f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,7 +20,10 @@ class PlaidAccount < ApplicationRecord
internal_account = family.accounts.find_or_initialize_by(plaid_account_id: plaid_account.id)
internal_account.name = plaid_data.name
# Only set the name for new records or if the name is not locked
if internal_account.new_record? || internal_account.enrichable?(:name)
internal_account.name = plaid_data.name
end
internal_account.balance = plaid_data.balances.current || plaid_data.balances.available
internal_account.currency = plaid_data.balances.iso_currency_code
internal_account.accountable = TYPE_MAPPING[plaid_data.type].new