diff --git a/app/interfaces/api/entities/document.rb b/app/interfaces/api/entities/document.rb index 3b3a4280a7..8b25df0ced 100644 --- a/app/interfaces/api/entities/document.rb +++ b/app/interfaces/api/entities/document.rb @@ -9,19 +9,19 @@ class Document < BaseEntity private def attachment - object.is_a?(ActiveStorage::Attachment) ? object : object.attachment + object.is_a?(ActiveStorage::Attachment) ? object : object.attachment.first end def url - attachment.blob.url(disposition: 'attachment') if attachment.attached? + attachment.first.blob.url(disposition: 'attachment') if attachment.first.attached? end def file_name - attachment.filename if attachment.attached? + attachment.first.filename if attachment.first.attached? end def size - attachment.byte_size if attachment.attached? + attachment.first.byte_size if attachment.first.attached? end end end diff --git a/app/presenters/message_presenter.rb b/app/presenters/message_presenter.rb index ce9604efaa..b2481885c7 100644 --- a/app/presenters/message_presenter.rb +++ b/app/presenters/message_presenter.rb @@ -8,7 +8,7 @@ def sender_is_a?(klass) def body h.tag.div do h.concat(simple_format(message.body)) - attachment_field if message.attachment.present? + attachment_field if message.attachment.first.present? end end