Steve Flinter’s blog

Musing on science and technology in Ireland

Steve Flinter’s blog header image 2

Comment and trackback spam

November 28th, 2006 by steve

Recently, my blog has been infested with comment and trackback spam. The default mechanisms in Typo to block spam are not great, in my opinion – certainly not up to the quality of spam management available in Wordpress. One step I have taken is to enable Akismet filtering. I have not used this before, so I have no idea how effective it will be.

In the meantime, I found myself with hundreds of spam comments and trackbacks that I had to deal with. Thankfully, I came across a console feature available on RoR applications (of which Typo is one). To get rid of all trackbacks, use the following:

Trackback.find_all.each { |t| t.destroy }

To get rid of all comments belonging to a particular post (article), you can to as follows:

Article.find(6).comments.each { |t| t.destroy }

The 6 in the above line is the id of the article that has the comment spam.

Clearly, this approach is no substitute to a proper spam management interface, but it does show how powerful the RoR console can be.

Tags: No Comments