From d00014221ed1a5666b2eb5952c15242613421562 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 3 Dec 2007 23:05:45 +0000 Subject: [PATCH] Changesets retrieval optimization on the activity view. Prevents additional query from being executed for each displayed changeset. git-svn-id: http://redmine.rubyforge.org/svn/trunk@952 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/projects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 658e9d23..c4d1b53f 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -442,7 +442,7 @@ class ProjectsController < ApplicationController end if @scope.include?('changesets') - @events += @project.repository.changesets.find(:all, :conditions => ["#{Changeset.table_name}.committed_on BETWEEN ? AND ?", @date_from, @date_to]) + @events += Changeset.find(:all, :include => :repository, :conditions => ["#{Repository.table_name}.project_id = ? AND #{Changeset.table_name}.committed_on BETWEEN ? AND ?", @project.id, @date_from, @date_to]) end if @scope.include?('messages')