From ed4c0886e2af2bbd3d6efa08f59d20c783843ef4 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 29 Oct 2016 14:16:13 +0000 Subject: [PATCH] Preload project and user. git-svn-id: http://svn.redmine.org/redmine/trunk@15940 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/timelog_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index cb747b273..74168a493 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -230,7 +230,7 @@ private end def find_time_entries - @time_entries = TimeEntry.where(:id => params[:id] || params[:ids]).to_a + @time_entries = TimeEntry.where(:id => params[:id] || params[:ids]).preload(:project, :user).to_a raise ActiveRecord::RecordNotFound if @time_entries.empty? raise Unauthorized unless @time_entries.all? {|t| t.editable_by?(User.current)} @projects = @time_entries.collect(&:project).compact.uniq