Class: Decidim::ContentBlockAttachment

Inherits:
ApplicationRecord show all
Includes:
HasUploadValidations
Defined in:
decidim-core/app/models/decidim/content_block_attachment.rb

Overview

Attachment can be any type of document or images related to a partcipatory process.

Instance Method Summary collapse

Methods included from HasUploadValidations

#maximum_avatar_size, #maximum_upload_size

Instance Method Details

#attached_uploader(name) ⇒ Object



29
30
31
32
33
# File 'decidim-core/app/models/decidim/content_block_attachment.rb', line 29

def attached_uploader(name)
  return unless name == :file

  uploader.new(self, :file)
end

#uploaderObject



17
18
19
20
21
22
23
24
25
26
27
# File 'decidim-core/app/models/decidim/content_block_attachment.rb', line 17

def uploader
  return if content_block.blank?

  config = manifest.images.find do |image_config|
    image_config[:name].to_s == name.to_s
  end

  return if config.blank?

  config[:uploader].constantize
end