validates_not_profane

Validate your Rails models against profanity. Don't filter; block!
Documentation
Repository

validates_not_profane

validates_not_profane provides a hook into the Profanalyzer gem as a validation for your ActiveRecord models. It's use is simple:

validates_not_profane :column_name, :column_2

Will cause the model to produce errors if that column contains profanity in its value. Of course, since the Profanalyzer gem is customizable, so is the validation:

validates_not_profane :post_title, :racist => true, :sexual => false

will block racial slurs, but nothing else.

validates_not_profane :post_title, :tolerance => 5

will block only the most vile of profanity. The scale for tolerance is from 0-5, which is mostly subjective, in all honesty.

You can also use the :label option to customize the error message - see the examples below.

== FEATURES/PROBLEMS:

== SYNOPSIS:

Group.rb:

    validates_not_profane :name
    validates_not_profane :permalink, :label => "URL"
    validates_not_profane :description, :racist => false, :sexual => true

Controller:

Group.create(:name => "Shitty Kids", 
             :permalink => "shitty", 
             :description => "i'm a dumb mick")

produces these errors:

The description, despite having a racial slur for Irish people in it, will pass validation. It's as simple as that!

Requirements

Installation

script/plugin install git://github.com/michaeledgar/validates_not_profane.git