diff --git a/app/controllers/admin/customers_controller.rb b/app/controllers/admin/customers_controller.rb index 630ffd361b..7a8598e268 100644 --- a/app/controllers/admin/customers_controller.rb +++ b/app/controllers/admin/customers_controller.rb @@ -65,7 +65,8 @@ module Admin def collection if json_request? && params[:enterprise_id].present? - CustomersWithBalance.new(managed_enterprise_id).query + CustomersWithBalance.new(managed_enterprise_id).query. + includes(:bill_address, :ship_address, user: :credit_cards) else Customer.where('1=0') end diff --git a/app/services/customers_with_balance.rb b/app/services/customers_with_balance.rb index 3cf667882a..12651ec14a 100644 --- a/app/services/customers_with_balance.rb +++ b/app/services/customers_with_balance.rb @@ -7,7 +7,6 @@ class CustomersWithBalance def query Customer.of(enterprise_id). - includes(:bill_address, :ship_address, user: :credit_cards). joins(left_join_non_cart_orders). group("customers.id"). select("customers.*").