summaryrefslogtreecommitdiffstats
path: root/app/helpers/attachments_helper.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-12-31 12:35:15 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-12-31 12:35:15 +0000
commitd521e49dbd3c48773c5e29abba6d325fbb5142c6 (patch)
tree4623368305e8bc08a7f7816963f36643a6451df4 /app/helpers/attachments_helper.rb
parente8cffd614e4acdc01a2cc04f98bad008ea12d0ce (diff)
downloadredmine-d521e49dbd3c48773c5e29abba6d325fbb5142c6.tar.gz
redmine-d521e49dbd3c48773c5e29abba6d325fbb5142c6.zip
Don't reload attachments if they are already loaded.
git-svn-id: http://svn.redmine.org/redmine/trunk@16113 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/attachments_helper.rb')
-rw-r--r--app/helpers/attachments_helper.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb
index 217382476..f7098322b 100644
--- a/app/helpers/attachments_helper.rb
+++ b/app/helpers/attachments_helper.rb
@@ -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?,