From 8eca359538515d1af54ea9b3566cc194ea104542 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 2 Jan 2020 15:22:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E7=8F=AD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/course.rb b/app/models/course.rb index 2f561bba7..0ac879905 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -146,7 +146,7 @@ class Course < ApplicationRecord def teacher_group(user_id) data = if teacher_course_groups.exists?(user_id: user_id) - teacher_course_groups.joins(:course_group).where(user_id: user_id) + teacher_course_groups.joins(:course_group).where(user_id: user_id).distinct .pluck('course_groups.id', 'course_groups.name') else course_groups.pluck(:id, :name)