summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-24 10:25:05 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-24 10:25:05 +0000
commite3ffb1f23b778e95833dccaa4d121753a2bfa760 (patch)
tree93ebae6de000aa15b85e3ac6fcdff9b10f1cf180 /app/helpers
parent726a9aa809383a8af2c3592cf573a655c24d2253 (diff)
downloadredmine-e3ffb1f23b778e95833dccaa4d121753a2bfa760.tar.gz
redmine-e3ffb1f23b778e95833dccaa4d121753a2bfa760.zip
Use journalized attachments to prevent a query when displaying added file.
git-svn-id: http://svn.redmine.org/redmine/trunk@13937 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/issues_helper.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index a112d76af..c16ce5022 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -356,7 +356,8 @@ module IssuesHelper
if detail.old_value && detail.value.blank? && detail.property != 'relation'
old_value = content_tag("del", old_value)
end
- if detail.property == 'attachment' && !value.blank? && atta = Attachment.find_by_id(detail.prop_key)
+ if detail.property == 'attachment' && value.present? &&
+ atta = detail.journal.journalized.attachments.detect {|a| a.id == detail.prop_key.to_i}
# Link to the attachment if it has not been removed
value = link_to_attachment(atta, :download => true, :only_path => options[:only_path])
if options[:only_path] != false && atta.is_text?