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