handle attahcment with send_file
This commit is contained in:
parent
ab0cfc0036
commit
a699ebdbcc
5 changed files with 19 additions and 2 deletions
8
app/controllers/files_controller.rb
Normal file
8
app/controllers/files_controller.rb
Normal file
|
@ -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
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue