= Validator Rails plugin

 Allows to validate user input data independently of a model.
 
 Can be used by two ways; Creating a +ActiveRecord::Validations::Validator+ class
 descendant where we declare sets of validation rules that can be used later.

   # Validator
   class UserValidator < ActiveRecord::Validations::Validator
     validates :card_type, :include => Customer::CARD_TYPES
     validates :card_number, :length => 13..16, :number => :unsigned_integer
   end

   # Controller
   class BlogController < ApplicationController
     def validate
        validator = UserValidator.new(params[:user])
        validator.validate(:card_type, :card_number)
        puts validator.errors.full_messages unless validator.errors.empty?
      end
    end

 Or using directly the +ActiveRecord::Validations::Validator+ class
   
   # Controller
   class BlogController < ApplicationController
     def validate
        validator = UserValidator.new(params[:user])
        validator.validate_with(:card_type, :include => Customer::CARD_TYPES)
        validator.validate_with(:card_number, :length => 13..16, :number => :unsigned_integer)
        puts validator.errors.full_messages unless validator.errors.empty?
      end
    end

 The validation rules in a set are chained, so that the validation in a set stops in the first
 rule that is not fulfilled. In this case, a new error message is added to validator +Errors+ object.
 
 The validation rules can be:
 * +strip+ - Leading and trailing whitespace is removed in each value by default. Set to +false+ to disable striping. 
 * +filled - Requires that the value be filled. Set to +:optional+ to bypass the validation silently if value is empty.
 * +number+ - Validates as a number (other options :integer|:unsigned|:unsigned_integer)
 * +length+ - Validates length. (examples: 34|2..12|{:min => 2, :max => 12})
 * +format+ - Regular expression to match
 * +include+ - Enumeration of possible rigth values
 * +exclude+ - Enumeration of wrong values
 * +confirm+ - true|:pass_confirm
 * +accept+ - true|'true' 
 * +unique+ - 'Customer.user'|['Customer.user', 1]
 * +associated+ - 'Customer.user'

== Download

The latest version of Validator Rails plugin can be found at

* http://rubyforge.org/projects/validator/

Documentation can be found at 

* http://validator.rubyforge.org

== Installation

Unpack the tgz file into Rails vendor/plugins directory.

== License

Ruby license.

== Support

RubyForge support page at
http://rubyforge.org/tracker/?group_id=1218

For other information mailto:josh@vectrice.com.