Save documents on disk

This commit is contained in:
Martin Lensment 2015-04-22 17:42:51 +03:00
parent a99d36f683
commit 79f76b2ccf
6 changed files with 41 additions and 6 deletions

View file

@ -3,7 +3,7 @@ class Admin::LegalDocumentsController < AdminController
def show
@ld = LegalDocument.find(params[:id])
file = Base64.decode64(@ld.body)
send_data file, filename: "#{@ld.created_at}.#{@ld.document_type}"
filename = @ld.path.split('/').last
send_data File.open(@ld.path).read, filename: filename
end
end