Class: Archangel::ApplicationUploader
- Inherits:
-
CarrierWave::Uploader::Base
- Object
- CarrierWave::Uploader::Base
- Archangel::ApplicationUploader
- Includes:
- CarrierWave::MiniMagick
- Defined in:
- app/uploaders/archangel/application_uploader.rb
Overview
Application base uploader
Direct Known Subclasses
Instance Method Summary collapse
-
#default_path ⇒ String
Uploaded path for file.
-
#default_url ⇒ String
Base URL where uploaded files as accessed.
-
#extension_whitelist ⇒ Array
File extension whitelist.
-
#image? ⇒ Boolean
Check if file is an image based on file content_type.
-
#store_dir ⇒ String
Storage path.
Instance Method Details
#default_path ⇒ String
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_url ⇒ String
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_whitelist ⇒ Array
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_dir ⇒ String
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 |