From 5c2a037a8f2ab396d0e614a57ab82b12f8522723 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Tue, 1 Apr 2014 21:03:52 +0800 Subject: [PATCH] user dup --- app/controllers/projects_controller.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 89bb87987..d2312e432 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -662,7 +662,10 @@ class ProjectsController < ApplicationController def sort_project_members project, members #userGrade = UserGrade.where(:project_id => project.id) - users = UserGrade.where(:project_id => project.id).order('grade DESC').joins("LEFT JOIN users ON users.id = user_grades.id") + users = UserGrade.where(:project_id => project.id). + order('grade DESC'). + joins("LEFT JOIN users ON users.id = user_grades.id"). + select("DISTINCT user_grades.user_id") memberlist = [] users.each do |user| members.each do |member|