From 8f30b27b586ebbc3da45191f795c7664c1ebd79d Mon Sep 17 00:00:00 2001 From: David Cook Date: Fri, 13 Oct 2023 10:43:55 +1100 Subject: [PATCH] Guard against nil values These are validated and shouldn't be nil, but I suspect we have corrupt data causing problems here. --- app/views/admin/products_v3/_table.html.haml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/admin/products_v3/_table.html.haml b/app/views/admin/products_v3/_table.html.haml index 28d2a3ded3..7e87f5db0c 100644 --- a/app/views/admin/products_v3/_table.html.haml +++ b/app/views/admin/products_v3/_table.html.haml @@ -56,9 +56,9 @@ -# TODO: new requirement "DISPLAY ON DEMAND IF ALL VARIANTS ARE ON DEMAND". And translate value .content= if product.variants.all?(&:on_demand) then "On demand" else product.on_hand || 0 end %td.align-left - .content= product.supplier.name + .content= product.supplier&.name %td.align-left - .content= product.primary_taxon.name + .content= product.primary_taxon&.name %td.align-left %td.align-left .content= product.inherits_properties ? 'YES' : 'NO' #TODO: consider using https://github.com/RST-J/human_attribute_values, else use I18n.t (also below) @@ -82,7 +82,7 @@ %td.align-right .content= variant.on_hand || 0 #TODO: spec for this according to requirements. %td.align-left - .content= variant.product.supplier.name # same as product + .content= variant.product.supplier&.name # same as product %td.align-left -# empty %td.align-left