mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-07 01:38:50 +01:00
show attachment in view and make it downloadable
This commit is contained in:
parent
2bd68fecb7
commit
f2c6c2d3af
4 changed files with 28 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue