diff --git a/app/models/principal.rb b/app/models/principal.rb index ea4b00f..451349d 100644 --- a/app/models/principal.rb +++ b/app/models/principal.rb @@ -61,7 +61,7 @@ class Principal < ActiveRecord::Base where("1=0") else ids = projects.map(&:id) - active.uniq.joins(:members).where("#{Member.table_name}.project_id IN (?)", ids) + active.where("#{Principal.table_name}.id IN (SELECT DISTINCT user_id FROM #{Member.table_name} WHERE project_id IN (?))", ids) end } # Principals that are not members of projects