diff --git a/app/jobs/pastes_cleanup_job.rb b/app/jobs/pastes_cleanup_job.rb index dd9780f..575dcfb 100644 --- a/app/jobs/pastes_cleanup_job.rb +++ b/app/jobs/pastes_cleanup_job.rb @@ -4,7 +4,7 @@ class PastesCleanupJob < ApplicationJob queue_as :default - def perform(paste) - paste.destroy + def perform(paste_id) + Paste.find_by(id: paste_id)&.destroy end end diff --git a/app/models/paste.rb b/app/models/paste.rb index 584d8e7..b0960e3 100644 --- a/app/models/paste.rb +++ b/app/models/paste.rb @@ -83,6 +83,6 @@ def create_permalink end def enqueue_removal - PastesCleanupJob.set(wait_until: remove_at).perform_later(self) + PastesCleanupJob.set(wait_until: remove_at).perform_later(self&.id) end end