Class: Alchemy::AttachmentsController

Inherits:
BaseController
  • Object
show all
Includes:
ActiveStorage::Streaming
Defined in:
app/controllers/alchemy/attachments_controller.rb

Instance Method Summary collapse

Methods included from Modules

included, #module_definition_for, register_module

Methods included from AbilityHelper

#current_ability

Methods included from ConfigurationMethods

#configuration, #multi_language?, #multi_site?, #prefix_locale?

Instance Method Details

#downloadObject

sends file as attachment. aka download



24
25
26
27
28
29
30
# File 'app/controllers/alchemy/attachments_controller.rb', line 24

def download
  if Alchemy.storage_adapter.dragonfly?
    send_attachment_file(disposition: :attachment)
  else
    send_attachment_blob(disposition: :attachment)
  end
end

#showObject

sends file inline. i.e. for viewing pdfs/movies in browser



15
16
17
18
19
20
21
# File 'app/controllers/alchemy/attachments_controller.rb', line 15

def show
  if Alchemy.storage_adapter.dragonfly?
    send_attachment_file(disposition: :inline)
  else
    send_attachment_blob(disposition: :inline)
  end
end