Sha256: 39fd866998b1cba51471d3d1153c0bb135cb75d1369175029dd17f70b60b31c4
Contents?: true
Size: 586 Bytes
Versions: 9
Compression:
Stored size: 586 Bytes
Contents
module CMS class AttachmentsController < RailsAdminCMS::Config.parent_controller before_action :authenticate_admin_user! def show name, format = params[:file].sub(/\?.+$/, ''), params[:format] file_name = "#{name}.#{format}" content_type = Mime::Type.lookup_by_extension(format) send_file( "#{Rails.root}/private/attachments/#{params[:directory]}/#{file_name}", type: content_type, filename: file_name, disposition: 'inline', x_sendfile: !Rails.env.development?, stream: true ) end end end
Version data entries
9 entries across 9 versions & 1 rubygems