Replaces find(:all) calls.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10921 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-12-02 20:43:16 +00:00
parent 5cb56fd1e4
commit 45ea24ecad

View File

@ -406,10 +406,12 @@ class Project < ActiveRecord::Base
# Returns an array of the trackers used by the project and its active sub projects # Returns an array of the trackers used by the project and its active sub projects
def rolled_up_trackers def rolled_up_trackers
@rolled_up_trackers ||= @rolled_up_trackers ||=
Tracker.find(:all, :joins => :projects, Tracker.
:select => "DISTINCT #{Tracker.table_name}.*", joins(:projects).
:conditions => ["#{Project.table_name}.lft >= ? AND #{Project.table_name}.rgt <= ? AND #{Project.table_name}.status <> #{STATUS_ARCHIVED}", lft, rgt], select("DISTINCT #{Tracker.table_name}.*").
:order => "#{Tracker.table_name}.position") where("#{Project.table_name}.lft >= ? AND #{Project.table_name}.rgt <= ? AND #{Project.table_name}.status <> #{STATUS_ARCHIVED}", lft, rgt).
sorted.
all
end end
# Closes open and locked project versions that are completed # Closes open and locked project versions that are completed