Sha256: 601cdbe5eaf85fce801340bc38798a2b0ad2b589d36806d4efa4623aed7eb40a
Contents?: true
Size: 865 Bytes
Versions: 13
Compression:
Stored size: 865 Bytes
Contents
module Alchemy class AttachmentsController < Alchemy::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_file( @attachment.public_filename, { :name => @attachment.filename, :type => @attachment.content_type, :disposition => 'inline' } ) end # sends file as attachment. aka download def download send_file( @attachment.full_filename, { :name => @attachment.filename, :type => @attachment.content_type, :disposition => 'attachment' } ) end private def load_attachment @attachment = Attachment.find(params[:id]) end end end
Version data entries
13 entries across 13 versions & 1 rubygems