This content was deleted by the author. You can see it from Blockchain History logs.

Rails Tip #03 - Deleting all the records

The task

Create a method that deletes all spam posts

in order to do this task, we need to have Post with a status of spam
then we can use symbol to proc with collect method to remove all the spam posts

Post.all.where(status: "spam").collect(&:destroy)