Class: MediaSnapshotUploader

Inherits:
CarrierWave::Uploader::Base
  • Object
show all
Includes:
CarrierWave::BombShelter, CarrierWave::MiniMagick
Defined in:
app/uploaders/media_snapshot_uploader.rb

Instance Method Summary collapse

Instance Method Details

#default_url(*args) ⇒ Object



17
18
19
# File 'app/uploaders/media_snapshot_uploader.rb', line 17

def default_url(*args)
  ActionController::Base.helpers.asset_path('biovision/base/placeholders/file.svg')
end

#extension_whitelistObject



29
30
31
# File 'app/uploaders/media_snapshot_uploader.rb', line 29

def extension_whitelist
  %w[jpg jpeg png]
end

#filenameObject



33
34
35
# File 'app/uploaders/media_snapshot_uploader.rb', line 33

def filename
  "#{model.uuid}.#{file.extension}" if original_filename
end

#store_dirObject

storage :fog



11
12
13
14
15
# File 'app/uploaders/media_snapshot_uploader.rb', line 11

def store_dir
  slug = "#{model.id / 10_000}/#{model.id / 100}/#{model.id}"

  "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{slug}"
end