Sha256: a97a86e566b11ab4605ef0d4000d60cb3b4c3805656a1c27b6ff8ae12497ffd8
Contents?: true
Size: 792 Bytes
Versions: 1
Compression:
Stored size: 792 Bytes
Contents
class ProtectedMediaController < Spud::ApplicationController before_filter :require_user def show @media = SpudMedia.where(:id => params[:id]).first if @media.blank? flash[:error] = "The requested file could not be found" redirect_to(root_url) else if Spud::Media.config.paperclip_storage == :s3 secure_url = @media.attachment.s3_object.url_for(:read, :secure => true, :expires => 10.minutes) redirect_to(secure_url.to_s) else filepath = File.join(Rails.root, @media.attachment.path) if !File.exists?(filepath) flash[:error] = "The requested file could not be found" redirect_to root_path else send_file(filepath, :disposition => 'inline') end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spud_media-0.9.0 | app/controllers/protected_media_controller.rb |