##// END OF EJS Templates
various eager loadings added...
Jean-Philippe Lang -
r95:3e28dc669b01
parent child
Show More
@@ -25,7 +25,7 class ApplicationController < ActionController::Base
25 25
26 26 def logged_in_user
27 27 if session[:user_id]
28 @logged_in_user ||= User.find(session[:user_id], :include => :memberships)
28 @logged_in_user ||= User.find(session[:user_id])
29 29 else
30 30 nil
31 31 end
@@ -175,7 +175,7 class ProjectsController < ApplicationController
175 175
176 176 # Show documents list of @project
177 177 def list_documents
178 @documents = @project.documents
178 @documents = @project.documents.find :all, :include => :category
179 179 end
180 180
181 181 # Add a new issue to @project
@@ -398,7 +398,7 class ProjectsController < ApplicationController
398 398 end
399 399
400 400 unless params[:show_news] == "0"
401 @project.news.find(:all, :conditions => ["news.created_on>=? and news.created_on<=?", @date_from, @date_to] ).each { |i|
401 @project.news.find(:all, :conditions => ["news.created_on>=? and news.created_on<=?", @date_from, @date_to], :include => :author ).each { |i|
402 402 @events_by_day[i.created_on.to_date] ||= []
403 403 @events_by_day[i.created_on.to_date] << i
404 404 }
@@ -406,7 +406,7 class ProjectsController < ApplicationController
406 406 end
407 407
408 408 unless params[:show_files] == "0"
409 Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN versions ON versions.id = attachments.container_id", :conditions => ["attachments.container_type='Version' and versions.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to] ).each { |i|
409 Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN versions ON versions.id = attachments.container_id", :conditions => ["attachments.container_type='Version' and versions.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i|
410 410 @events_by_day[i.created_on.to_date] ||= []
411 411 @events_by_day[i.created_on.to_date] << i
412 412 }
@@ -418,7 +418,7 class ProjectsController < ApplicationController
418 418 @events_by_day[i.created_on.to_date] ||= []
419 419 @events_by_day[i.created_on.to_date] << i
420 420 }
421 Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN documents ON documents.id = attachments.container_id", :conditions => ["attachments.container_type='Document' and documents.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to] ).each { |i|
421 Attachment.find(:all, :select => "attachments.*", :joins => "LEFT JOIN documents ON documents.id = attachments.container_id", :conditions => ["attachments.container_type='Document' and documents.project_id=? and attachments.created_on>=? and attachments.created_on<=?", @project.id, @date_from, @date_to], :include => :author ).each { |i|
422 422 @events_by_day[i.created_on.to_date] ||= []
423 423 @events_by_day[i.created_on.to_date] << i
424 424 }
@@ -20,7 +20,7 class Project < ActiveRecord::Base
20 20 has_many :members, :dependent => true
21 21 has_many :users, :through => :members
22 22 has_many :custom_values, :dependent => true, :as => :customized
23 has_many :issues, :dependent => true, :order => "issues.created_on DESC", :include => :status
23 has_many :issues, :dependent => true, :order => "issues.created_on DESC", :include => [:status, :tracker]
24 24 has_many :queries, :dependent => true
25 25 has_many :documents, :dependent => true
26 26 has_many :news, :dependent => true, :include => :author
General Comments 0
You need to be logged in to leave comments. Login now