##// END OF EJS Templates
Improve performance of Principal.member_of scope...
Jean-Baptiste Barth -
r12864:1914d1a15984
parent child
Show More
@@ -61,7 +61,7 class Principal < ActiveRecord::Base
61 where("1=0")
61 where("1=0")
62 else
62 else
63 ids = projects.map(&:id)
63 ids = projects.map(&:id)
64 active.uniq.joins(:members).where("#{Member.table_name}.project_id IN (?)", ids)
64 active.where("#{Principal.table_name}.id IN (SELECT DISTINCT user_id FROM #{Member.table_name} WHERE project_id IN (?))", ids)
65 end
65 end
66 }
66 }
67 # Principals that are not members of projects
67 # Principals that are not members of projects
General Comments 0
You need to be logged in to leave comments. Login now