Class: HeroImageUploader
- Inherits:
-
CarrierWave::Uploader::Base
- Object
- CarrierWave::Uploader::Base
- HeroImageUploader
- Includes:
- CarrierWave::RMagick
- Defined in:
- app/uploaders/hero_image_uploader.rb
Overview
CarrierWave uploader for hero images.
Instance Method Summary collapse
-
#default_url ⇒ Object
Returns URL for image-asset.
- #root ⇒ Object
-
#store_dir ⇒ Object
Override the directory where uploaded files will be stored.
Instance Method Details
#default_url ⇒ Object
Returns URL for image-asset
23 24 25 |
# File 'app/uploaders/hero_image_uploader.rb', line 23 def default_url "/assets/heroes/" + [filename].compact.join('_') end |
#root ⇒ Object
27 28 29 |
# File 'app/uploaders/hero_image_uploader.rb', line 27 def root Rails.root.join 'public/' end |
#store_dir ⇒ Object
Override the directory where uploaded files will be stored. This is a sensible default for uploaders that are meant to be mounted:
16 17 18 |
# File 'app/uploaders/hero_image_uploader.rb', line 16 def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end |