removes TempFile after 7 days [fixes SCI-160]

This commit is contained in:
zmagod 2017-05-05 14:54:22 +02:00
parent 1cedad0d7e
commit f079a097c5
2 changed files with 9 additions and 0 deletions

View file

@ -53,6 +53,7 @@ class TeamsController < ApplicationController
)
if @temp_file.save
@temp_file.destroy_obsolete_files
# format.html
format.json {
render :json => {

View file

@ -3,4 +3,12 @@ class TempFile < ActiveRecord::Base
has_attached_file :file
do_not_validate_attachment_file_type :file
def destroy_obsolete_files
file = TempFile.find_by_id(self.id)
file.destroy! if file
end
handle_asynchronously :destroy_obsolete_files,
run_at: proc { 7.days.from_now }
end