From e8d0c26e4393b0d88f9c62afd12268269b1bd818 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 11 Nov 2008 12:50:11 +0000 Subject: [PATCH] Eager-load users. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2009 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/repository.rb | 2 +- app/models/repository/git.rb | 2 +- app/models/repository/subversion.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/repository.rb b/app/models/repository.rb index 0cae37d06..003f30552 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -78,7 +78,7 @@ class Repository < ActiveRecord::Base # Default behaviour: we search in cached changesets def changesets_for_path(path) path = "/#{path}" unless path.starts_with?('/') - Change.find(:all, :include => :changeset, + Change.find(:all, :include => {:changeset => :user}, :conditions => ["repository_id = ? AND path = ?", id, path], :order => "committed_on DESC, #{Changeset.table_name}.id DESC").collect(&:changeset) end diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb index 6fcb760e6..41d4b6498 100644 --- a/app/models/repository/git.rb +++ b/app/models/repository/git.rb @@ -30,7 +30,7 @@ class Repository::Git < Repository end def changesets_for_path(path) - Change.find(:all, :include => :changeset, + Change.find(:all, :include => {:changeset => :user}, :conditions => ["repository_id = ? AND path = ?", id, path], :order => "committed_on DESC, #{Changeset.table_name}.revision DESC").collect(&:changeset) end diff --git a/app/models/repository/subversion.rb b/app/models/repository/subversion.rb index 3981d6f4c..9515e6b76 100644 --- a/app/models/repository/subversion.rb +++ b/app/models/repository/subversion.rb @@ -32,7 +32,7 @@ class Repository::Subversion < Repository def changesets_for_path(path) revisions = scm.revisions(path) - revisions ? changesets.find_all_by_revision(revisions.collect(&:identifier), :order => "committed_on DESC") : [] + revisions ? changesets.find_all_by_revision(revisions.collect(&:identifier), :order => "committed_on DESC", :include => :user) : [] end # Returns a path relative to the url of the repository -- 2.39.5