]> source.dussan.org Git - redmine.git/commitdiff
Attachment activity provider SQL optimization (#37057).
authorGo MAEDA <maeda@farend.jp>
Sat, 14 May 2022 07:38:36 +0000 (07:38 +0000)
committerGo MAEDA <maeda@farend.jp>
Sat, 14 May 2022 07:38:36 +0000 (07:38 +0000)
Patch by Jens Krämer.

git-svn-id: https://svn.redmine.org/redmine/trunk@21573 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/attachment.rb

index bbc9a4660dbfc747b698f3a7cb7800186e09a87b..7c60c7164422e0b24620b2ef2469bec6bc8860c0 100644 (file)
@@ -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' " \