Created
March 24, 2015 02:13
-
-
Save cwise/57ea0043f39ef4f3c7fe to your computer and use it in GitHub Desktop.
Delete broken images
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
images = Spree::Image.all.reject do |image| | |
begin | |
open image.attachment.url | |
putc '.' | |
true | |
rescue | |
puts image.attachment.url | |
false | |
end | |
end | |
images.each{ |i| i.destroy } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment