Conventional Validations

Conventional Validations is a plugin that attempts to apply validation based on the naming of columns. Specifically, the plugin searches for validation methods such that a column named foo or ending in _foo would be validated using a method named validates_foo.

For example, by defining a class method as:

def self.validates_phone(*attr_names)
  validates_format_of attr_names, :with => /[0-9]+(\.[0-9]+)*/, :allow_nil => true
end

Any columns named phone or ending in _phone would be automatically validated.

Dependencies

See Also

Installation

EDGE

To install using SVN:
ruby script/plugin install svn://rubyforge.org/var/svn/redhillonrails/trunk/vendor/plugins/conventional_validations

or using HTTP:
ruby script/plugin install http://redhillonrails.rubyforge.org/svn/trunk/vendor/plugins/conventional_validations

2.0 Stable

To install using SVN:
ruby script/plugin install svn://rubyforge.org/var/svn/redhillonrails/branches/stable-2.0/vendor/plugins/conventional_validations

or using HTTP:
ruby script/plugin install http://redhillonrails.rubyforge.org/svn/branches/stable-2.0/vendor/plugins/conventional_validations