diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-06-12 19:13:25 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-06-12 19:13:25 +0000 |
commit | f9ddb562d58ae98bcc69f74396b028cbc8cce0b1 (patch) | |
tree | 8019be9178fb3d14c764c04e3e3a5be955de1385 /lib | |
parent | 136cdc765afda57b9be02704e52b27334da42c73 (diff) | |
download | redmine-f9ddb562d58ae98bcc69f74396b028cbc8cce0b1.tar.gz redmine-f9ddb562d58ae98bcc69f74396b028cbc8cce0b1.zip |
Cleanup of finders with :conditions option.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11963 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redmine/helpers/gantt.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb index 1625801f9..198de20a0 100644 --- a/lib/redmine/helpers/gantt.rb +++ b/lib/redmine/helpers/gantt.rb @@ -162,11 +162,12 @@ module Redmine ids = issues.collect(&:project).uniq.collect(&:id) if ids.any? # All issues projects and their visible ancestors - @projects = Project.visible.all( - :joins => "LEFT JOIN #{Project.table_name} child ON #{Project.table_name}.lft <= child.lft AND #{Project.table_name}.rgt >= child.rgt", - :conditions => ["child.id IN (?)", ids], - :order => "#{Project.table_name}.lft ASC" - ).uniq + @projects = Project.visible. + joins("LEFT JOIN #{Project.table_name} child ON #{Project.table_name}.lft <= child.lft AND #{Project.table_name}.rgt >= child.rgt"). + where("child.id IN (?)", ids). + order("#{Project.table_name}.lft ASC"). + uniq. + all else @projects = [] end |