Patch #37687 » reduce-extra-queries-in-journal-attachments.patch
| app/models/journal.rb | ||
|---|---|---|
| 142 | 142 |
end |
| 143 | 143 | |
| 144 | 144 |
def attachments |
| 145 |
details.select{ |d| d.property == 'attachment' }.map{ |d| Attachment.find_by(:id => d.prop_key) }.compact
|
|
| 145 |
ids = details.select {|d| d.property == 'attachment'}.map(&:prop_key).compact
|
|
| 146 |
Attachment.where(id: ids).to_a |
|
| 146 | 147 |
end |
| 147 | 148 | |
| 148 | 149 |
# Returns a string of css classes |