mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-10 23:07:47 +00:00
Merge pull request #7212 from coopdevs/remove-n+1-on-admin-customers
Fix multiple N+1s on /admin/customers.json
This commit is contained in:
@@ -74,7 +74,12 @@ module Admin
|
||||
def collection
|
||||
if json_request? && params[:enterprise_id].present?
|
||||
customers_relation.
|
||||
includes(:bill_address, :ship_address, user: :credit_cards)
|
||||
includes(
|
||||
:enterprise,
|
||||
{ bill_address: [:state, :country] },
|
||||
{ ship_address: [:state, :country] },
|
||||
user: :credit_cards
|
||||
)
|
||||
else
|
||||
Customer.where('1=0')
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user