From 7d3e763f017c43e0438cbfaf88bbebd0bef1f208 Mon Sep 17 00:00:00 2001 From: Bianca Nenciu Date: Fri, 23 Sep 2022 15:00:02 +0300 Subject: [PATCH] FIX: Query correct model in posts:inline_uploads (#18330) Follow up to commit 9db8f00b3dd6f2881adf1b786e29426889225e7a. --- lib/tasks/posts.rake | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/tasks/posts.rake b/lib/tasks/posts.rake index f0b664fb3e4..e3225f8ada2 100644 --- a/lib/tasks/posts.rake +++ b/lib/tasks/posts.rake @@ -662,10 +662,7 @@ def correct_inline_uploads dry_run = (ENV["DRY_RUN"].nil? ? true : ENV["DRY_RUN"] != "false") verbose = ENV["VERBOSE"] - scope = Upload - .joins(:upload_references) - .where(upload_references: { target_type: 'Post' }) - .distinct("posts.id") + scope = Post.joins(:upload_references).distinct("posts.id") .where(<<~SQL) raw LIKE '%/uploads/#{RailsMultisite::ConnectionManagement.current_db}/original/%' SQL