mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
Fix N+1 in CachedEnterpriseSerializer
This commit is contained in:
@@ -163,7 +163,11 @@ module Api
|
||||
private
|
||||
|
||||
def product_properties
|
||||
enterprise.supplied_products.flat_map(&:properties)
|
||||
Spree::Property.joins(:product_properties).where(
|
||||
spree_product_properties: {
|
||||
product_id: enterprise.supplied_product_ids
|
||||
}
|
||||
).select('DISTINCT spree_properties.*')
|
||||
end
|
||||
|
||||
def producer_properties
|
||||
|
||||
Reference in New Issue
Block a user