mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-09 15:35:22 +02:00
Merge branch 'main' into rule-name
This commit is contained in:
commit
d8c7d6aee6
2 changed files with 32 additions and 4 deletions
|
@ -62,8 +62,18 @@ class Account < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def institution_domain
|
def institution_domain
|
||||||
return nil unless plaid_account&.plaid_item&.institution_url.present?
|
url_string = plaid_account&.plaid_item&.institution_url
|
||||||
URI.parse(plaid_account.plaid_item.institution_url).host.gsub(/^www\./, "")
|
return nil unless url_string.present?
|
||||||
|
|
||||||
|
begin
|
||||||
|
uri = URI.parse(url_string)
|
||||||
|
# Use safe navigation on .host before calling gsub
|
||||||
|
uri.host&.gsub(/^www\./, "")
|
||||||
|
rescue URI::InvalidURIError
|
||||||
|
# Log a warning if the URL is invalid and return nil
|
||||||
|
Rails.logger.warn("Invalid institution URL encountered for account #{id}: #{url_string}")
|
||||||
|
nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy_later
|
def destroy_later
|
||||||
|
|
|
@ -1,7 +1,25 @@
|
||||||
<%# locals: (transfer:, is_inflow: false) %>
|
<%# locals: (transfer:, is_inflow: false) %>
|
||||||
<div class="flex items-center gap-1">
|
<div class="flex items-center gap-1">
|
||||||
<% first_account, second_account = is_inflow ? [transfer.to_account, transfer.from_account] : [transfer.from_account, transfer.to_account] %>
|
<% first_account, second_account = is_inflow ? [transfer.to_account, transfer.from_account] : [transfer.from_account, transfer.to_account] %>
|
||||||
<%= link_to first_account.name, account_path(first_account, tab: "activity"), class: "hover:underline", data: { turbo_frame: "_top" } %>
|
|
||||||
|
<%# Check if first_account exists before creating link %>
|
||||||
|
<% if first_account %>
|
||||||
|
<%= link_to first_account.name, account_path(first_account, tab: "activity"), class: "hover:underline", data: { turbo_frame: "_top" } %>
|
||||||
|
<% else %>
|
||||||
|
<span class="text-warning text-xs italic" title="Transfer ID: <%= transfer.id %>">
|
||||||
|
Data Error: Missing account
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%# Use icon helper per conventions %>
|
||||||
<%= icon(is_inflow ? "arrow-left" : "arrow-right", size: "sm") %>
|
<%= icon(is_inflow ? "arrow-left" : "arrow-right", size: "sm") %>
|
||||||
<%= link_to second_account.name, account_path(second_account, tab: "activity"), class: "hover:underline", data: { turbo_frame: "_top" } %>
|
|
||||||
|
<%# Check if second_account exists before creating link %>
|
||||||
|
<% if second_account %>
|
||||||
|
<%= link_to second_account.name, account_path(second_account, tab: "activity"), class: "hover:underline", data: { turbo_frame: "_top" } %>
|
||||||
|
<% else %>
|
||||||
|
<span class="text-warning text-xs italic" title="Transfer ID: <%= transfer.id %>">
|
||||||
|
Data Error: Missing account
|
||||||
|
</span>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue