Class: FormAttachment
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- FormAttachment
- Includes:
- SentryLogging, SetGuid
- Defined in:
- app/models/form_attachment.rb
Direct Known Subclasses
DecisionReviewEvidenceAttachment, Form1010cg::Attachment, HCAAttachment, Preneeds::PreneedAttachment, SupportingEvidenceAttachment
Instance Method Summary collapse
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
#get_file ⇒ Object
28 29 30 31 32 33 34 |
# File 'app/models/form_attachment.rb', line 28 def get_file = .retrieve_from_store!( parsed_file_data['filename'] ) .file end |
#parsed_file_data ⇒ Object
24 25 26 |
# File 'app/models/form_attachment.rb', line 24 def parsed_file_data @parsed_file_data ||= JSON.parse(file_data) end |
#set_file_data!(file, file_password = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'app/models/form_attachment.rb', line 14 def set_file_data!(file, file_password = nil) = file = unlock_pdf(file, file_password) if file_password.present? .store!(file) self.file_data = { filename: .filename }.to_json rescue CarrierWave::IntegrityError => e log_exception_to_sentry(e, nil, nil, 'warn') raise Common::Exceptions::UnprocessableEntity.new(detail: e., source: 'FormAttachment.set_file_data') end |