Sha256: ffbf89a1549af79c6e338dd4fba4a3b4ced8c60cda690d483c7309e4cf5b1608
Contents?: true
Size: 759 Bytes
Versions: 13
Compression:
Stored size: 759 Bytes
Contents
module Alchemy class AttachmentsController < BaseController before_action :load_attachment authorize_resource class: Alchemy::Attachment # sends file inline. i.e. for viewing pdfs/movies in browser def show send_file( @attachment.file.path, { filename: @attachment.file_name, type: @attachment.file_mime_type, disposition: 'inline' } ) end # sends file as attachment. aka download def download send_file( @attachment.file.path, { filename: @attachment.file_name, type: @attachment.file_mime_type } ) end private def load_attachment @attachment = Attachment.find(params[:id]) end end end
Version data entries
13 entries across 13 versions & 1 rubygems