From 1dace1f0e34390a886163d04af0a202a330cd41f Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Tue, 19 May 2020 18:03:58 +0100 Subject: [PATCH] Make quantifier use stock_items relation and not an array because sum will behave differently with an array in rails 4.1 --- app/models/spree/stock/quantifier.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/spree/stock/quantifier.rb b/app/models/spree/stock/quantifier.rb index 21f1750ca0..01e9b77cb1 100644 --- a/app/models/spree/stock/quantifier.rb +++ b/app/models/spree/stock/quantifier.rb @@ -30,7 +30,7 @@ module Spree def fetch_stock_items # Don't re-fetch associated stock items from the DB if we've already eager-loaded them - return @variant.stock_items.to_a if @variant.stock_items.loaded? + return @variant.stock_items if @variant.stock_items.loaded? Spree::StockItem.joins(:stock_location). where(:variant_id => @variant, Spree::StockLocation.table_name => { active: true })