Class: Decidim::ApplicationUploader

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

Overview

This class deals with uploading files 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

#skip_ssrf_protection?(_uri) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'app/uploaders/decidim/application_uploader.rb', line 20

def skip_ssrf_protection?(_uri)
  true
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:



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

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