From b880020527a6b8abb3e6c5e03c8df412f33308f8 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 13 Nov 2012 22:15:47 +0000 Subject: [PATCH] Code cleanup. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10804 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/principal.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 } -- 2.39.5