summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-02 20:43:16 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-02 20:43:16 +0000
commit45ea24ecad0e7e40ff499de7b7eab5678f88c31a (patch)
treec3ff2fb207a1fb2a0e5276d6bc3e36fecadad389
parent5cb56fd1e4230dd8a199adab98565b9dc3bb9596 (diff)
downloadredmine-45ea24ecad0e7e40ff499de7b7eab5678f88c31a.tar.gz
redmine-45ea24ecad0e7e40ff499de7b7eab5678f88c31a.zip
Replaces find(:all) calls.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10921 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/project.rb10
1 files changed, 6 insertions, 4 deletions
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