class Para::ActiveStorageDownloader

Attributes

attachment[R]

Public Class Methods

new(attachment) click to toggle source
# File lib/para/active_storage_downloader.rb, line 9
def initialize(attachment)
  @attachment = attachment
end

Public Instance Methods

download_blob_to_tempfile(&block) click to toggle source

For versions of ActiveStorage that don’t have an ActiveStorage::Downloading module, we define the method ourselves, as defined in the ActiveStorage::Analyzer and ActiveStorage::Previewer classes, which is simple enough to be copied here.

# File lib/para/active_storage_downloader.rb, line 20
def download_blob_to_tempfile(&block)
  blob.open tmpdir: Dir.tmpdir, &block
end