Perf: preload a few associations for bulk operations.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11957 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
32464f4912
commit
3e9aeea75d
|
@ -298,7 +298,7 @@ class ApplicationController < ActionController::Base
|
|||
# Find issues with a single :id param or :ids array param
|
||||
# Raises a Unauthorized exception if one of the issues is not visible
|
||||
def find_issues
|
||||
@issues = Issue.find_all_by_id(params[:id] || params[:ids])
|
||||
@issues = Issue.where(:id => (params[:id] || params[:ids])).preload(:project, :status, :tracker, :priority, :author, :assigned_to, :relations_to).to_a
|
||||
raise ActiveRecord::RecordNotFound if @issues.empty?
|
||||
raise Unauthorized unless @issues.all?(&:visible?)
|
||||
@projects = @issues.collect(&:project).compact.uniq
|
||||
|
|
Loading…
Reference in New Issue