confirmation

You should use this helper when you have two text fields that should receive exactly the same content. For example, you may want to confirm an email address or a password. This validation creates a virtual attribute whose name is the name of the field that has to be confirmed with "_confirmation" appended.

# model
class AnyModel < ActiveRecord::Base
  validates: password, confirmation: true
end

# view
<%= text_field :any_model, :password %>
<%= text_field :any_model, :password_confirmation %>

Reference

results matching ""

    No results matching ""