Class: Alchemy::AttachmentsController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- Alchemy::AttachmentsController
- Defined in:
- app/controllers/alchemy/attachments_controller.rb
Instance Method Summary collapse
-
#download ⇒ Object
sends file as attachment.
-
#show ⇒ Object
sends file inline.
Methods included from Modules
included, #module_definition_for, register_module
Methods included from AbilityHelper
Methods included from ConfigurationMethods
#configuration, #multi_language?, #multi_site?, #prefix_locale?
Instance Method Details
#download ⇒ Object
sends file as attachment. aka download
19 20 21 22 23 24 25 26 |
# File 'app/controllers/alchemy/attachments_controller.rb', line 19 def download send_file( @attachment.file.path, { filename: @attachment.file_name, type: @attachment.file_mime_type } ) end |
#show ⇒ Object
sends file inline. i.e. for viewing pdfs/movies in browser
7 8 9 10 11 12 13 14 15 16 |
# File 'app/controllers/alchemy/attachments_controller.rb', line 7 def show send_file( @attachment.file.path, { filename: @attachment.file_name, type: @attachment.file_mime_type, disposition: 'inline' } ) end |