Project

General

Profile

Patch #37687 » reduce-extra-queries-in-journal-attachments.patch

Go MAEDA, 2022-09-19 10:44

View differences:

app/models/journal.rb
end
def attachments
details.select{ |d| d.property == 'attachment' }.map{ |d| Attachment.find_by(:id => d.prop_key) }.compact
ids = details.select {|d| d.property == 'attachment'}.map(&:prop_key).compact
Attachment.where(id: ids).to_a
end
# Returns a string of css classes
(1-1/3)