mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-13 00:15:48 +08:00
Merge pull request #592 from ZmagoD/zd_SCI_160
removes TempFile after 7 days [fixes SCI-160]
This commit is contained in:
commit
ff0f85fce8
2 changed files with 8 additions and 0 deletions
|
@ -53,6 +53,7 @@ class TeamsController < ApplicationController
|
|||
)
|
||||
|
||||
if @temp_file.save
|
||||
@temp_file.destroy_obsolete
|
||||
# format.html
|
||||
format.json {
|
||||
render :json => {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue