From a699ebdbcc11051b9473a88788cf8efdde659975 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 11 Feb 2013 21:31:19 +0200 Subject: handle attahcment with send_file --- app/controllers/files_controller.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 app/controllers/files_controller.rb (limited to 'app/controllers/files_controller.rb') diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb new file mode 100644 index 00000000000..f13a543cfdd --- /dev/null +++ b/app/controllers/files_controller.rb @@ -0,0 +1,8 @@ +class FilesController < ApplicationController + def download + uploader = Note.find(params[:id]).attachment + uploader.retrieve_from_store!(params[:filename]) + send_file uploader.file.path, disposition: 'attachment' + end +end + -- cgit v1.2.1