From: Go MAEDA Date: Sat, 14 May 2022 07:38:36 +0000 (+0000) Subject: Attachment activity provider SQL optimization (#37057). X-Git-Tag: 5.1.0~605 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fe1202d6266fb578c61d690289ad283ac08a6560;p=redmine.git Attachment activity provider SQL optimization (#37057). Patch by Jens Krämer. git-svn-id: https://svn.redmine.org/redmine/trunk@21573 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/attachment.rb b/app/models/attachment.rb index bbc9a4660..7c60c7164 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -48,6 +48,7 @@ class Attachment < ActiveRecord::Base :scope => proc do select("#{Attachment.table_name}.*"). + where(container_type: ['Version', 'Project']). joins( "LEFT JOIN #{Version.table_name} " \ "ON #{Attachment.table_name}.container_type='Version' " \