validates_confirmation_of :email_address
In the preceding example, email_address is an actual database-backed attribute. A new
virtual attribute that is not represented by a column in the database is created named
email_address_confirmation.
APPENDIX ?– ACTIVE RECORD METHODS IN DETAIL 258
In addition to the attributes to validate the confirmation, this method takes the configuration
options of :message, :on, and :if.
The :message option provides a custom error message. The default error message is
"doesn't match confirmation".
validates_confirmation_of :email_address, :message => "does not match"
The :on option specifies for what methods this validation should be active. Valid options
are :save, :create, and :update. The default value is :save.
validates_confirmation_of :email_address, :on => :create
The :if option specifies a method, proc, or string that is called in order to determine
whether the validation should occur at all:
validates_confirmation_of :email_address, :if => :check_email
validates_confirmation_of :email_address, :if => "check_email"
validates_confirmation_of :email_address, :if => Proc.
Pages:
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563