Patch #39847 ยป cache-journal-attachments.patch
app/models/journal.rb | ||
---|---|---|
142 | 142 |
end |
143 | 143 | |
144 | 144 |
def attachments |
145 |
ids = details.select {|d| d.property == 'attachment' && d.value.present?}.map(&:prop_key) |
|
146 |
Attachment.where(id: ids).sort_by {|a| ids.index(a.id.to_s)} |
|
145 |
@attachments ||= begin |
|
146 |
ids = details.select {|d| d.property == 'attachment' && d.value.present?}.map(&:prop_key) |
|
147 |
ids.empty? ? [] : Attachment.where(id: ids).sort_by {|a| ids.index(a.id.to_s)} |
|
148 |
end |
|
147 | 149 |
end |
148 | 150 | |
149 | 151 |
def visible?(*args) |