From 367cee593fbfa435ea04b9d51600f99017ce08d7 Mon Sep 17 00:00:00 2001 From: Nihal Mohammed Date: Thu, 13 May 2021 01:12:13 +0530 Subject: [PATCH] Move eager loading line_items to controller --- app/controllers/spree/users_controller.rb | 2 +- app/views/spree/users/show.html.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/spree/users_controller.rb b/app/controllers/spree/users_controller.rb index a591e20064..18effc349d 100644 --- a/app/controllers/spree/users_controller.rb +++ b/app/controllers/spree/users_controller.rb @@ -14,7 +14,7 @@ module Spree def show @payments_requiring_action = PaymentsRequiringAction.new(spree_current_user).query - @orders = orders_collection + @orders = orders_collection.includes(:line_items) customers = spree_current_user.customers @shops = Enterprise diff --git a/app/views/spree/users/show.html.haml b/app/views/spree/users/show.html.haml index c85ae06d75..6fa0d875e2 100644 --- a/app/views/spree/users/show.html.haml +++ b/app/views/spree/users/show.html.haml @@ -1,5 +1,5 @@ - content_for :injection_data do - = inject_json_array("orders", @orders.all.includes(:line_items), Api::OrderSerializer) + = inject_json_array("orders", @orders.all, Api::OrderSerializer) = inject_json_array("shops", @shops.all, Api::ShopForOrdersSerializer) = inject_saved_credit_cards