Merge pull request #4425 from Matt-Yorkley/admin_eager_loading

Eager-load variant associations in admin ProductsController
This commit is contained in:
Luis Ramos
2019-11-11 15:29:45 +00:00
committed by GitHub

View File

@@ -109,7 +109,14 @@ module Api
scope = Spree::Product.active
end
scope.includes(:master)
scope.includes(product_query_includes)
end
def product_query_includes
[
master: [:images],
variants: [:default_price, :stock_locations, :stock_items, :variant_overrides]
]
end
def paged_products_for_producers(producers)