Make quantifier use stock_items relation and not an array because sum will behave differently with an array in rails 4.1

This commit is contained in:
Luis Ramos
2020-05-19 18:03:58 +01:00
parent 08d26102d2
commit 1dace1f0e3

View File

@@ -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 })