diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-06-11 17:24:17 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-06-11 17:24:17 +0000 |
commit | 3e9aeea75d7fec0f312726d890212262eaf940fa (patch) | |
tree | 9c128a34b34fb6c960ea1e587561e94929713efe /app/controllers | |
parent | 32464f491251a609d3429346bc250984a2a4f9be (diff) | |
download | redmine-3e9aeea75d7fec0f312726d890212262eaf940fa.tar.gz redmine-3e9aeea75d7fec0f312726d890212262eaf940fa.zip |
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
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/application_controller.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a3fbae5aa..7f42fff76 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 |