diff --git a/app/models/journal.rb b/app/models/journal.rb index 919a07dd2..92da4fca9 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -142,7 +142,8 @@ class Journal < ActiveRecord::Base 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