Skip to content

A platform for community discussion. Free, open, simple.

FIX: Query correct model in posts:inline_uploads (#18330)

Bianca Nenciu7d3e763f017c
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