Commit e8d0c26e authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Eager-load users.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2009 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 4ed95fff
...@@ -78,7 +78,7 @@ class Repository < ActiveRecord::Base ...@@ -78,7 +78,7 @@ class Repository < ActiveRecord::Base
# Default behaviour: we search in cached changesets # Default behaviour: we search in cached changesets
def changesets_for_path(path) def changesets_for_path(path)
path = "/#{path}" unless path.starts_with?('/') path = "/#{path}" unless path.starts_with?('/')
Change.find(:all, :include => :changeset, Change.find(:all, :include => {:changeset => :user},
:conditions => ["repository_id = ? AND path = ?", id, path], :conditions => ["repository_id = ? AND path = ?", id, path],
:order => "committed_on DESC, #{Changeset.table_name}.id DESC").collect(&:changeset) :order => "committed_on DESC, #{Changeset.table_name}.id DESC").collect(&:changeset)
end end
......
...@@ -30,7 +30,7 @@ class Repository::Git < Repository ...@@ -30,7 +30,7 @@ class Repository::Git < Repository
end end
def changesets_for_path(path) def changesets_for_path(path)
Change.find(:all, :include => :changeset, Change.find(:all, :include => {:changeset => :user},
:conditions => ["repository_id = ? AND path = ?", id, path], :conditions => ["repository_id = ? AND path = ?", id, path],
:order => "committed_on DESC, #{Changeset.table_name}.revision DESC").collect(&:changeset) :order => "committed_on DESC, #{Changeset.table_name}.revision DESC").collect(&:changeset)
end end
......
...@@ -32,7 +32,7 @@ class Repository::Subversion < Repository ...@@ -32,7 +32,7 @@ class Repository::Subversion < Repository
def changesets_for_path(path) def changesets_for_path(path)
revisions = scm.revisions(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 end
# Returns a path relative to the url of the repository # Returns a path relative to the url of the repository
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment