Class: CMS::FilesController
- Inherits:
-
Object
- Object
- CMS::FilesController
- Defined in:
- app/controllers/cms/files_controller.rb
Instance Method Summary collapse
Instance Method Details
#show ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/cms/files_controller.rb', line 3 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 |