summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-11-13 22:15:47 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-11-13 22:15:47 +0000
commitb880020527a6b8abb3e6c5e03c8df412f33308f8 (patch)
tree9611c4820b73466e679f12f4035faee59df86662
parent547b85c4ef3105a00de8e9f4c5e7627bd49c7e37 (diff)
downloadredmine-b880020527a6b8abb3e6c5e03c8df412f33308f8.tar.gz
redmine-b880020527a6b8abb3e6c5e03c8df412f33308f8.zip
Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10804 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/principal.rb8
1 files 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
}