Class: Archangel::ApplicationUploader

Inherits:
CarrierWave::Uploader::Base
  • Object
show all
Includes:
CarrierWave::MiniMagick
Defined in:
app/uploaders/archangel/application_uploader.rb

Overview

Application base uploader

Direct Known Subclasses

AssetUploader, AvatarUploader, LogoUploader

Instance Method Summary collapse

Instance Method Details

#default_pathString

Uploaded path for file


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

def default_path
  "/images/fallback/" + [version_name, "default.png"].compact.join("_")
end

#default_urlString

Base URL where uploaded files as accessed


24
25
26
# File 'app/uploaders/archangel/application_uploader.rb', line 24

def default_url
  ActionController::Base.helpers.asset_path(default_path)
end

#extension_whitelistArray

File extension whitelist


42
43
44
# File 'app/uploaders/archangel/application_uploader.rb', line 42

def extension_whitelist
  Archangel.config.image_extension_whitelist
end

#image?Boolean

Check if file is an image based on file content_type


51
52
53
# File 'app/uploaders/archangel/application_uploader.rb', line 51

def image?
  image_formats.include?(file.content_type)
end

#store_dirString

Storage path


15
16
17
# File 'app/uploaders/archangel/application_uploader.rb', line 15

def store_dir
  "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end