Rake task fixed for Shring

This commit is contained in:
Christoph Haas 2021-02-25 00:14:08 +01:00
parent 5ce1df07f3
commit 0a5c64d17c

View file

@ -10,10 +10,9 @@ namespace :debshots do
# TODO: fix for Shrine - this only works for Paperclip
Screenshot.all.each do |screenshot|
# Check that the file actually exists
path = screenshot.image.path(:large)
# Rails.logger.info "- #{screenshot.id} (package: #{screenshot.package.name}) (path: #{path})"
path = Rails.root.join('public' + screenshot.simage_url(:large))
unless path and (File.file? path)
Rails.logger.info "Screenshot #{screenshot.id} image file not found at path '#{path}'. Removing."
Rails.logger.info "Screenshot ##{screenshot.id}'s image file not found at path '#{path}'. Removing."
screenshot.delete
end
end