Sha256: b35381e63cd95ffda536f5e1fe562a8ab028ef50b4132d262a5969075e1f0b30
Contents?: true
Size: 537 Bytes
Versions: 9
Compression:
Stored size: 537 Bytes
Contents
module CMS class FilesController < RailsAdminCMS::Config.parent_controller def show file_path = Viewable::Link.find(params[:id]).file file_name = File.basename(file_path) ext = File.extname(file_name).sub('.', '') content_type = Mime::Type.lookup_by_extension(ext) send_file( "#{Rails.root}/public#{file_path}", 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