mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-29 03:35:25 +08:00
refactor
This commit is contained in:
parent
f079a097c5
commit
04ee24d553
2 changed files with 4 additions and 5 deletions
|
@ -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 => {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue