@ -20,4 +20,14 @@ class AttachmentHistory < ApplicationRecord
is_public == 1
end
def is_history_pdf?
is_pdf = false
file_content_type = content_type
file_ext_type = File.extname(filename).strip.downcase[1..-1]
if (file_content_type.present? && file_content_type.downcase.include?("pdf")) || (file_ext_type.present? && file_ext_type.include?("pdf"))
is_pdf = true
is_pdf
@ -7,4 +7,4 @@ json.quotes attachment.quotes_count
json.downloads_count attachment.downloads_count
json.created_on attachment.created_on
json.url attachment_path(attachment, type: 'history')
json.is_pdf attachment.is_pdf?
json.is_pdf attachment.is_history_pdf?