How to find any missing images?

ok we worked out a way, one that skips the output of the three “most offending” columns:

"raw", "cooked", "raw_email

posts = Post.where("cooked LIKE '%/uploads/default/%' AND cooked NOT LIKE '%/uploads/default/original/%' AND cooked NOT LIKE '%/uploads/default/optimized/%'"); 42
CSV.open("/tmp/posts-to-review.csv", "wb") do |csv|
  csv << Post.attribute_names - ["raw", "cooked", "raw_email"]
  posts.each do |post|
    csv << post.attributes.except("raw", "cooked", "raw_email").values
  end
end
  • Skip printing the output by typing q,
  • Exit the ruby via exit
  • clear the screen, then use cat /tmp/posts-to-review.csv

I guess I could have channeled it to the shared folder… but this works.

(edited to add clearer steps)