Class: HeroImageUploader

Inherits:
CarrierWave::Uploader::Base
  • Object
show all
Includes:
CarrierWave::RMagick
Defined in:
app/uploaders/hero_image_uploader.rb

Overview

CarrierWave uploader for hero images.

Instance Method Summary collapse

Instance Method Details

#default_urlObject

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

#rootObject



27
28
29
# File 'app/uploaders/hero_image_uploader.rb', line 27

def root
  Rails.root.join 'public/'
end

#store_dirObject

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