Skip to content

armgit / maybe

Public Imported from GitHub
0

The personal finance app for everyone

Fix holding name error (#1113)

Zach Gollwitzer4433488562a0
diff --git a/Procfile.dev b/Procfile.dev
index d04ee87d..18f6d0df 100644
--- a/Procfile.dev
+++ b/Procfile.dev
@@ -1,3 +1,3 @@
-web: bin/rails server -b 0.0.0.0
+web: ${DEBUG:+rdbg -O -n -c --} bin/rails server -b 0.0.0.0
css: bin/rails tailwindcss:watch
worker: bundle exec good_job start
diff --git a/app/models/account/holding.rb b/app/models/account/holding.rb
index 73dd8c02..34f6efe7 100644
--- a/app/models/account/holding.rb
+++ b/app/models/account/holding.rb
@@ -14,9 +14,12 @@ class Account::Holding < ApplicationRecord
scope :known_value, -> { where.not(amount: nil) }
scope :for, ->(security) { where(security_id: security).order(:date) }
- delegate :name, to: :security
delegate :ticker, to: :security
+ def name
+ security.name || ticker
+ end
+
def weight
return nil unless amount
diff --git a/app/views/account/holdings/_holding.html.erb b/app/views/account/holdings/_holding.html.erb
index 83f84254..19a0c52c 100644
--- a/app/views/account/holdings/_holding.html.erb
+++ b/app/views/account/holdings/_holding.html.erb
@@ -3,9 +3,11 @@
<%= turbo_frame_tag dom_id(holding) do %>
<div class="grid grid-cols-12 items-center text-gray-900 text-sm font-medium p-4">
<div class="col-span-4 flex items-center gap-4">
- <%= render "shared/circle_logo", name: holding.name || "H" %>
+ <%= render "shared/circle_logo", name: holding.name %>
+
<div class="space-y-0.5">
- <%= link_to holding.name || holding.ticker, account_holding_path(holding.account, holding), data: { turbo_frame: :drawer }, class: "hover:underline" %>
+ <%= link_to holding.name, account_holding_path(holding.account, holding), data: { turbo_frame: :drawer }, class: "hover:underline" %>
+
<% if holding.amount %>
<%= tag.p holding.ticker, class: "text-gray-500 text-xs uppercase" %>
<% else %>