Make sure we don't build an empty IN () statement (#11662).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10241 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-08-27 10:09:08 +00:00
parent c68ee7f545
commit 50506ef621
1 changed files with 1 additions and 1 deletions

View File

@ -187,7 +187,7 @@ class Project < ActiveRecord::Base
end
if user.logged?
user.projects_by_role.each do |role, projects|
if role.allowed_to?(permission)
if role.allowed_to?(permission) && projects.any?
statement_by_role[role] = "#{Project.table_name}.id IN (#{projects.collect(&:id).join(',')})"
end
end