]> source.dussan.org Git - redmine.git/commitdiff
Don't reload attachments if they are already loaded.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 31 Dec 2016 12:35:15 +0000 (12:35 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 31 Dec 2016 12:35:15 +0000 (12:35 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@16113 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/attachments_helper.rb

index 217382476f5a24274cb2f0f5a06ca27d94af2d4b..f7098322b373e36c1f409e0310658ab4b3a6e95e 100644 (file)
@@ -34,7 +34,12 @@ module AttachmentsHelper
   def link_to_attachments(container, options = {})
     options.assert_valid_keys(:author, :thumbnails)
 
-    attachments = container.attachments.preload(:author).to_a
+    attachments = if container.attachments.loaded?
+      container.attachments
+    else
+      container.attachments.preload(:author).to_a
+    end
+
     if attachments.any?
       options = {
         :editable => container.attachments_editable?,