wire up downloading attachments from todo partial

This commit is contained in:
Reinier Balt 2014-07-06 22:29:19 +02:00
parent 4d7c453ca7
commit 6405bf5d1a
5 changed files with 32 additions and 3 deletions

View file

@ -701,7 +701,6 @@ class TodosController < ApplicationController
@tag = Tag.where(:name => @tag_name).first_or_create
end
def tags
# TODO: limit to current_user
tags_beginning = Tag.where('name like ?', params[:term]+'%')
@ -815,6 +814,23 @@ class TodosController < ApplicationController
end
end
def attachment
id = params[:id]
filename = params[:filename]
attachment = Attachment.where(id: id).first
if attachment
if attachment.todo.user == current_user
send_file(attachment.file.path)
else
head :forbidden
end
else
head :not_found
end
end
private
def set_group_view_by