This commit is contained in:
zmagod 2017-05-09 14:05:21 +02:00
parent f079a097c5
commit 04ee24d553
2 changed files with 4 additions and 5 deletions

View file

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

View file

@ -4,11 +4,10 @@ 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
def destroy_obsolete
destroy! if self
end
handle_asynchronously :destroy_obsolete_files,
handle_asynchronously :destroy_obsolete,
run_at: proc { 7.days.from_now }
end