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)
Hey man, a little context about these snippets would help a lot. Especially those who are seeing your posts for the first time.
Thanks
Nice post
Ops thanks for this story
Thanks for share,nice post.
Could you please explain how this works? Thanks
upvote, comment plz
hey @bilal-haider that's an amazing task. I am impressed by your programming skills. Definitely we will perform this task.
looking forward for more posts from you.
Thanks :) will keep posting.
nice post
You get a resteem from getupvote.
Follow me @getupvote and get a upvote and resteem thank u