From 4d122503bb7339d8d87fb54ae5f65ab30c17edd5 Mon Sep 17 00:00:00 2001 From: CassioMarques Date: Fri, 7 Nov 2008 23:51:45 -0200 Subject: Added some aditional info to validates_confirmation_of --- .../html/activerecord_validations_callbacks.html | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'railties/doc/guides/html') diff --git a/railties/doc/guides/html/activerecord_validations_callbacks.html b/railties/doc/guides/html/activerecord_validations_callbacks.html index 0f03a7ebae..1f11ce4d08 100644 --- a/railties/doc/guides/html/activerecord_validations_callbacks.html +++ b/railties/doc/guides/html/activerecord_validations_callbacks.html @@ -408,6 +408,24 @@ http://www.gnu.org/software/src-highlite -->
<%= text_field :person, :email %>
 <%= text_field :person, :email_confirmation %>
+
+ + + +
+Note +This check is performed only if email_confirmation is not nil, and by default only on save. To require confirmation, make sure to add a presence check for the confirmation attribute:
+
+
+
+
class Person < ActiveRecord::Base
+  validates_confirmation_of :email
+  validates_presence_of :email_confirmation
+end
+

The default error message for validates_confirmation_of is "doesn't match confirmation"

3.4. The validates_each helper

3.5. The validates_exclusion_of helper

-- cgit v1.2.3