We have a requirement to have comments on an application auto-moderated for obscenities etc. There will still be a real world moderating looking at comments, but they want to filter out the really bad stuff automatically.
What would be the best way to do this?
You’ll want to use something like Akismet. Last I checked, it’s the thing WordPress uses to prevent comment spam. It’s pretty straightforward, too.
Here are a couple links:
(always excellent, but a little old
so may not current with Rails 3
though)
using Akismet in Rails
Here’s a gem/plugin: Rakismet
As for profanity instead of general spam, you might want something like WebPurify (first one I found). You can hack your own together by blacklisting profane words and using Ruby’s elegant string handling to replace/filter them, but that would probably be a never ending battle against 1337 speak and stuff like that. Plus it’s probably better practice to outsource something like that, if possible.