module ActiveModel::Validations::HelperMethods
def validates_confirmation_of(*attr_names)
+:if+, +:unless+, +:on+, +:allow_nil+, +:allow_blank+, and +:strict+.
There is also a list of default options supported by every validator:
non-text columns (+true+ by default).
* :case_sensitive - Looks for an exact match. Ignored by
%{translated_attribute_name}").
* :message - A custom error message (default is: "doesn't match
Configuration options:
validates_presence_of :password_confirmation, if: :password_changed?
the confirmation attribute:
+nil+. To require confirmation, make sure to add a presence check for
NOTE: This check is performed only if +password_confirmation+ is not
attribute.
the validation adds accessors to the model for the confirmation
as an in-memory attribute for validating the password. To achieve this,
The added +password_confirmation+ attribute is virtual; it exists only
<%= password_field "person", "password_confirmation" %>
<%= password_field "person", "password" %>
View:
end
message: 'should match confirmation'
validates_confirmation_of :email_address,
validates_confirmation_of :user_name, :password
class Person < ActiveRecord::Base
Model:
address field with a confirmation.
Encapsulates the pattern of wanting to validate a password or email
def validates_confirmation_of(*attr_names) validates_with ConfirmationValidator, _merge_attributes(attr_names) end