From e7a23b2b13e003caf21a9f1b844b837ff1b87365 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 28 Nov 2019 16:16:27 +0800 Subject: [PATCH] 1 --- app/queries/admins/school_query.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/queries/admins/school_query.rb b/app/queries/admins/school_query.rb index 87e83babf..c53b1222f 100644 --- a/app/queries/admins/school_query.rb +++ b/app/queries/admins/school_query.rb @@ -19,7 +19,7 @@ class Admins::SchoolQuery < ApplicationQuery end Rails.logger.info("#########school_name: ##{schools.first.name}") Rails.logger.info("#########school_id: ##{schools.first.id}") - schools = schools.joins(:user_extensions).group("schools.id") + schools = schools.joins("right join user_extensions on user_extensions.school_id = schools.id").group("schools.id") Rails.logger.info("#########school_id: ##{schools.first.id}") schools = schools.select('schools.*, COUNT(*) AS users_count') custom_sort schools, params[:sort_by], params[:sort_direction]