Sha256: aa0ff2a342988b9557a1c4e861c290f80103d2fb8ea14955abb4f12631d9e1eb
Contents?: true
Size: 820 Bytes
Versions: 11
Compression:
Stored size: 820 Bytes
Contents
module Alchemy class AttachmentsController < BaseController filter_access_to [:show, :download], :attribute_check => true, :model => Alchemy::Attachment, :load_method => :load_attachment # sends file inline. i.e. for viewing pdfs/movies in browser def show send_data( @attachment.file.data, { :filename => @attachment.file_name, :type => @attachment.file_mime_type, :disposition => 'inline' } ) end # sends file as attachment. aka download def download send_data( @attachment.file.data, { :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
11 entries across 11 versions & 1 rubygems