Class: Decidim::ApplicationUploader

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

Overview

This class deals with uploading images to Decidim It is intended to just hold the uploads configuration, so you should inherit from this class and then tweak any configuration you need.

Instance Method Summary collapse

Instance Method Details

#store_dirObject

Override the directory where uploaded files will be stored. This is a sensible default for uploaders that are meant to be mounted:



10
11
12
13
14
15
16
# File 'app/uploaders/decidim/application_uploader.rb', line 10

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

  return File.join(Decidim.base_uploads_path, default_path) if Decidim.base_uploads_path.present?

  default_path
end