From: Jean-Philippe Lang Date: Mon, 27 Aug 2012 10:09:08 +0000 (+0000) Subject: Make sure we don't build an empty IN () statement (#11662). X-Git-Tag: 2.1.0~102 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=50506ef621b1f4d67a8fd350b1d94bf09dd07c9b;p=redmine.git 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 --- diff --git a/app/models/project.rb b/app/models/project.rb index e9525ec60..92af86f12 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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