show attachment in view and make it downloadable

This commit is contained in:
Reinier Balt 2015-08-05 13:02:41 +02:00
parent 2bd68fecb7
commit f2c6c2d3af
4 changed files with 28 additions and 0 deletions

View file

@ -815,6 +815,20 @@ class TodosController < ApplicationController
end
end
def attachment
id = params[:id]
filename = params[:filename]
attachment = current_user.attachments.find(id)
if attachment
send_file(attachment.file.path,
disposition: 'attachment',
type: 'message/rfc822')
else
head :not_found
end
end
private
def set_group_view_by