Module: CarrierWave::Uploader::Download

Extended by:
ActiveSupport::Concern
Includes:
Cache, Callbacks, Configuration
Included in:
Base
Defined in:
lib/carrierwave/uploader/download.rb

Instance Method Summary collapse

Methods included from Cache

#cache!, #cache_name, #cache_path, #cache_stored_file!, #cached?, #retrieve_from_cache!, #sanitized_file

Methods included from Callbacks

#with_callbacks

Instance Method Details

#download!(uri, remote_headers = {}) ⇒ Object

Caches the file by downloading it from the given URL, using downloader.

Parameters

url (String)

The URL where the remote file is stored

remote_headers (Hash)

Request headers



18
19
20
21
# File 'lib/carrierwave/uploader/download.rb', line 18

def download!(uri, remote_headers = {})
  file = downloader.new(self).download(uri, remote_headers)
  cache!(file)
end