From 831a3bcd5033fa70bb1ccc3e9ba8b7b7ac910755 Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Wed, 10 Aug 2022 15:08:37 +0200 Subject: [PATCH] chore: Fix RemoveStaleNotificationJob query (#5242) Rubocop amended the query in #5236, which led to failure as the Message model already has a default scope. This PR fixes it. --- app/jobs/migration/remove_stale_notifications_job.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/jobs/migration/remove_stale_notifications_job.rb b/app/jobs/migration/remove_stale_notifications_job.rb index bceecfcbe..fcd8bee8d 100644 --- a/app/jobs/migration/remove_stale_notifications_job.rb +++ b/app/jobs/migration/remove_stale_notifications_job.rb @@ -10,7 +10,8 @@ class Migration::RemoveStaleNotificationsJob < ApplicationJob def remove_invalid_messages deleted_ids = [] - Message.distinct.pluck(:inbox_id).each_slice(1000) do |id_list| + + Message.unscoped.distinct.pluck(:inbox_id).each_slice(1000) do |id_list| deleted_ids << (id_list - Inbox.where(id: id_list).pluck(:id)) end