From c54aa9db444cf387c9a4516f76c89145ec31915a Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 30 Jul 2019 16:56:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E6=8A=A5=E5=90=8D=E7=9A=84?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=88=97=E8=A1=A8=E6=97=A0=E6=8C=87=E5=AF=BC?= =?UTF-8?q?=E8=80=81=E5=B8=88=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 7e3b3eb0..ee06834d 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -1105,12 +1105,12 @@ end school_ids = School.where("schools.name like '%#{params[:school]}%'").pluck(:id) school_ids = school_ids.size == 0 ? "(-1)" : "(" + school_ids.join(",") + ")" location = params[:location] && params[:location] != "0" ? params[:location] : "" - @team_members = @team_members.where("user_extensions.school_id in #{school_ids} and schools.province like '%#{location}%'") + @team_members = @team_members.includes(user: { user_extensions: :school }).where("user_extensions.school_id in #{school_ids} and schools.province like '%#{location}%'") end @page = params[:page] || 1 @team_members = @team_members.reorder("team_members.created_at #{@order}") all_members = @team_members - @team_members = paginateHelper(@team_members.includes(competition_team: [:user, teachers: :user], user: { user_extensions: :school }), 50) + @team_members = paginateHelper(@team_members.preload(competition_team: [:user, teachers: :user], user: { user_extensions: :school }), 50) respond_to do |format| format.js format.html