diff --git a/app/models/principal.rb b/app/models/principal.rb index 02b0007f7..dfafe9de9 100644 --- a/app/models/principal.rb +++ b/app/models/principal.rb @@ -48,20 +48,20 @@ class Principal < ActiveRecord::Base scope :member_of, lambda {|projects| projects = [projects] unless projects.is_a?(Array) if projects.empty? - {:conditions => "1=0"} + where("1=0") else ids = projects.map(&:id) - {:conditions => ["#{Principal.table_name}.status = 1 AND #{Principal.table_name}.id IN (SELECT DISTINCT user_id FROM #{Member.table_name} WHERE project_id IN (?))", ids]} + where("#{Principal.table_name}.status = 1 AND #{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 scope :not_member_of, lambda {|projects| projects = [projects] unless projects.is_a?(Array) if projects.empty? - {:conditions => "1=0"} + where("1=0") else ids = projects.map(&:id) - {:conditions => ["#{Principal.table_name}.id NOT IN (SELECT DISTINCT user_id FROM #{Member.table_name} WHERE project_id IN (?))", ids]} + where("#{Principal.table_name}.id NOT IN (SELECT DISTINCT user_id FROM #{Member.table_name} WHERE project_id IN (?))", ids) end }