ActiveRecord::Validations::ClassMethods
validates_acceptance_of
validates_associated
validates confirmation_of
validates_each
validates_exclusion_of
validates_format_of
validates_inclusion_of
validates_length_of
validates_numericality_of
validates_presence_of
validates_size_of
validates_uniqueness_of
class Person < ActiveRecord::Base validates_presence_of :first_name, :last_name, :login, :email validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i validates_inclusion_of :funkce, :in => %w[THP VL OZ S P] validates_uniqueness_of :login private def validate errors.ass(:person, " can't be root.") if self.login == 'root' end end