scinote-web/app/models/temp_file.rb

14 lines
303 B
Ruby
Raw Normal View History

2017-06-23 21:19:08 +08:00
class TempFile < ApplicationRecord
2016-02-12 23:52:43 +08:00
validates :session_id, presence: true
has_attached_file :file
do_not_validate_attachment_file_type :file
2017-05-09 20:05:21 +08:00
def destroy_obsolete
destroy! if self
end
2017-05-09 20:05:21 +08:00
handle_asynchronously :destroy_obsolete,
run_at: proc { 7.days.from_now }
2016-02-12 23:52:43 +08:00
end