March 2011 Archives

Rails 3 Validator List

Ruby on Rails 3.0 expanded the set of available validators that can be passed to validates. Here they are in list form:

:acceptance => Boolean.
:confirmation => Boolean.
:exclusion => { :in => Enumerable }.
:inclusion => { :in => Enumerable }.
:format => { :with => Regexp, :on => :create }.
:length => { :maximum => Fixnum }.
:numericality => Boolean.
:presence => Boolean.
:uniqueness => Boolean.

Source: the Rails 3.0 release notes