Add comment to better explain why this scope is not simply using joins(:product)

This commit is contained in:
Luis Ramos
2020-03-06 12:30:13 +00:00
parent 8909238682
commit a4c7dbc329

View File

@@ -46,6 +46,9 @@ Spree::LineItem.class_eval do
where('order_cycles.id = ?', order_cycle)
}
# Here we are simply joining the line item to its variant and product
# We do this with SQL to avoid the default scopes,
# and with that, include deleted variants and deleted products
scope :supplied_by_any, lambda { |enterprises|
joins("LEFT OUTER JOIN spree_variants
ON spree_line_items.variant_id = spree_variants.id