mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Eager-load line_item associations in order
This commit is contained in:
@@ -263,7 +263,11 @@ Spree::Order.class_eval do
|
||||
end
|
||||
|
||||
def line_item_variants
|
||||
line_items.map(&:variant)
|
||||
if line_items.loaded?
|
||||
line_items.map(&:variant)
|
||||
else
|
||||
line_items.includes(:variant).map(&:variant)
|
||||
end
|
||||
end
|
||||
|
||||
# Show already bought line items of this order cycle
|
||||
|
||||
Reference in New Issue
Block a user