Skip to content

Commit

Permalink
Include access control post when loading uploads in rake task
Browse files Browse the repository at this point in the history
* to avoid N+1 query
  • Loading branch information
martin-brennan committed Feb 18, 2020
1 parent 59a7afb commit cfd56e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/tasks/uploads.rake
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ task "uploads:ensure_correct_acl" => :environment do
#
# Also only get uploads that are not for a theme or a site setting, so only
# get post related uploads.
uploads_with_supported_media = Upload.includes(:posts, :optimized_images).where(
uploads_with_supported_media = Upload.includes(:posts, :access_control_post, :optimized_images).where(
"LOWER(original_filename) SIMILAR TO '%\.(jpg|jpeg|png|gif|svg|ico|mp3|ogg|wav|m4a|mov|mp4|webm|ogv)'"
).joins(:post_uploads)

Expand Down

0 comments on commit cfd56e9

Please sign in to comment.