From f1b64e90e08f7b48d1f31420946ccf9542e66f03 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Wed, 25 Mar 2020 11:49:14 +0000 Subject: [PATCH] Add comment to explain unusual fix --- app/models/spree/line_item_decorator.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/spree/line_item_decorator.rb b/app/models/spree/line_item_decorator.rb index 7012cec9ec..37637f7564 100644 --- a/app/models/spree/line_item_decorator.rb +++ b/app/models/spree/line_item_decorator.rb @@ -71,8 +71,10 @@ Spree::LineItem.class_eval do where('spree_adjustments.id IS NULL') } + # Overridden so that LineItems always have access to soft-deleted Variant attributes + # In some situations, unscoped super will be nil, in these cases we fetch the variant using the variant_id + # See isssue #4946 for more details def variant - # Overridden so that LineItems always have access to soft-deleted Variant attributes Spree::Variant.unscoped { super } || Spree::Variant.unscoped.find(self.variant_id) end