Module: PolicyManager::Concerns::ActiveStorageBehavior

Extended by:
ActiveSupport::Concern
Included in:
PortabilityRequest
Defined in:
app/models/policy_manager/concerns/active_storage_behavior.rb

Instance Method Summary collapse

Instance Method Details



24
25
26
27
28
29
# File 'app/models/policy_manager/concerns/active_storage_behavior.rb', line 24

def download_link
  return '' unless self.attachment.attached?
  url = Rails.application.routes.url_helpers.rails_blob_path(self.attachment, only_path: true)
  #self.attachment.expiring_url(PolicyManager::Config.exporter.expiration_link)
  PolicyManager::Config.exporter.customize_link(url)
end

#file_remote_url=(url_value) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/models/policy_manager/concerns/active_storage_behavior.rb', line 10

def file_remote_url=(url_value)
  
  self.attachment.attach(
    io: File.open(url_value), 
    filename: File.basename(url_value),
    content_type: 'application/zip'
  ) unless url_value.blank?

  #self.attachment = File.open(url_value) unless url_value.blank?
  
  self.save
  self.complete!
end