Merge pull request #592 from ZmagoD/zd_SCI_160

removes TempFile after 7 days [fixes SCI-160]
This commit is contained in:
Zmago Devetak 2017-05-10 09:32:18 +02:00 committed by GitHub
commit ff0f85fce8
2 changed files with 8 additions and 0 deletions

View file

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

View file

@ -3,4 +3,11 @@ class TempFile < ActiveRecord::Base
has_attached_file :file
do_not_validate_attachment_file_type :file
def destroy_obsolete
destroy! if self
end
handle_asynchronously :destroy_obsolete,
run_at: proc { 7.days.from_now }
end