]> source.dussan.org Git - redmine.git/commitdiff
Preload project and user.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 29 Oct 2016 14:16:13 +0000 (14:16 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 29 Oct 2016 14:16:13 +0000 (14:16 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@15940 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/timelog_controller.rb

index cb747b27322a7e82d5eb8ff131d3ec1ee3d5adeb..74168a493401da028ca3749f441144d5aa18ce79 100644 (file)
@@ -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