If you want to cut down on the nastier elements getting through to your Web site, filling in contact forms, and generally causing havoc, consider the rbl_check plugin by Joost.
rbl_check is a Rails plugin that checks every incoming request to see if the client is listed on a Real-time Blackhole List. This helps prevent abuse from spammers/crackers.
Basic source for implementing a block is included.
