Class: SupportingEvidenceAttachment

Inherits:
FormAttachment show all
Defined in:
app/models/supporting_evidence_attachment.rb

Overview

Files uploaded as part of a form526 submission that will be sent to EVSS upon form submission. inherits from ApplicationRecord

Constant Summary collapse

ATTACHMENT_UPLOADER_CLASS =
SupportingEvidenceAttachmentUploader

Instance Method Summary collapse

Methods inherited from FormAttachment

#get_file, #parsed_file_data

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger

Methods inherited from ApplicationRecord

descendants_using_encryption, lockbox_options, #timestamp_attributes_for_update_in_model, #valid?

Instance Method Details

#converted_filenameObject



19
20
21
# File 'app/models/supporting_evidence_attachment.rb', line 19

def converted_filename
  JSON.parse(file_data)['converted_filename']
end

#set_file_data!(file, file_password = nil) ⇒ Object

this uploads the file to S3 through its parent class the final filename comes from the uploader once the file is successfully uploaded to S3



10
11
12
13
14
15
16
17
# File 'app/models/supporting_evidence_attachment.rb', line 10

def set_file_data!(file, file_password = nil)
  file_data_json = super
  au = get_attachment_uploader
  if au.converted_exists?
    self.file_data = JSON.parse(file_data_json).merge('converted_filename' => au.final_filename).to_json
  end
  file_data
end