From 5efa8268f63ce5dfffb59b1070cfd5f7204dac4d Mon Sep 17 00:00:00 2001 From: Alex Hatzenbuhler Date: Fri, 16 May 2025 10:23:57 -0500 Subject: [PATCH] Attempt name override (#2244) --- app/models/plaid_account.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/models/plaid_account.rb b/app/models/plaid_account.rb index 4f60013e..4730985d 100644 --- a/app/models/plaid_account.rb +++ b/app/models/plaid_account.rb @@ -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