From 45ea24ecad0e7e40ff499de7b7eab5678f88c31a Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 2 Dec 2012 20:43:16 +0000 Subject: Replaces find(:all) calls. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10921 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/project.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/models/project.rb b/app/models/project.rb index d1d89636e..5a8ba855b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -406,10 +406,12 @@ class Project < ActiveRecord::Base # Returns an array of the trackers used by the project and its active sub projects def rolled_up_trackers @rolled_up_trackers ||= - Tracker.find(:all, :joins => :projects, - :select => "DISTINCT #{Tracker.table_name}.*", - :conditions => ["#{Project.table_name}.lft >= ? AND #{Project.table_name}.rgt <= ? AND #{Project.table_name}.status <> #{STATUS_ARCHIVED}", lft, rgt], - :order => "#{Tracker.table_name}.position") + Tracker. + joins(:projects). + select("DISTINCT #{Tracker.table_name}.*"). + where("#{Project.table_name}.lft >= ? AND #{Project.table_name}.rgt <= ? AND #{Project.table_name}.status <> #{STATUS_ARCHIVED}", lft, rgt). + sorted. + all end # Closes open and locked project versions that are completed -- cgit v1.2.3