validates_blacklist

Validation of Rails models against a database, supporting scoped validation.

Install

Add the following to config/environment.rb

config.gem "bartzon-validates_blacklist", :lib => "validates_blacklist"

And run

rake gems:install

After these steps, generate a migration with:

script/generate blacklists

Usage

Add the follow to each model you want to have validated:

class User < ActiveRecord::Base

  validates_blacklist
    :fields => [:name] # required, specify the fields to validate
    :message => "" # optional, defaults to "is not allowed"
    :scope => nil # optional, set this to for instance a class name to allow blacklist validation per class

end