Module: DataMapper::Validations::ValidatesConfirmation

### Home Classes Methods

### In Files

- lib/dm-validations/validators/confirmation_validator.rb

### Methods

- #validates_confirmation_of

### Files

- LICENSE
- README.rdoc

### Class/Module Index

Quicksearch

- DataMapper
- DataMapper::InvalidContextError
- DataMapper::Validate
- DataMapper::ValidationError
- DataMapper::Validations
- DataMapper::Validations::AbsenceValidator
- DataMapper::Validations::AcceptanceValidator
- DataMapper::Validations::AutoValidations
- DataMapper::Validations::AutoValidations::ModelExtension
- DataMapper::Validations::ClassMethods
- DataMapper::Validations::ConfirmationValidator
- DataMapper::Validations::Context
- DataMapper::Validations::ContextualValidators
- DataMapper::Validations::Format
- DataMapper::Validations::Format::Email
- DataMapper::Validations::Format::Url
- DataMapper::Validations::FormatValidator
- DataMapper::Validations::GenericValidator
- DataMapper::Validations::LengthValidator
- DataMapper::Validations::MethodValidator
- DataMapper::Validations::NumericalityValidator
- DataMapper::Validations::OrderedHash
- DataMapper::Validations::PresenceValidator
- DataMapper::Validations::PrimitiveTypeValidator
- DataMapper::Validations::UniquenessValidator
- DataMapper::Validations::UnknownValidationFormat
- DataMapper::Validations::ValidatesAbsence
- DataMapper::Validations::ValidatesAcceptance
- DataMapper::Validations::ValidatesConfirmation
- DataMapper::Validations::ValidatesFormat
- DataMapper::Validations::ValidatesLength
- DataMapper::Validations::ValidatesNumericality
- DataMapper::Validations::ValidatesPresence
- DataMapper::Validations::ValidatesPrimitiveType
- DataMapper::Validations::ValidatesUniqueness
- DataMapper::Validations::ValidatesWithBlock
- DataMapper::Validations::ValidatesWithMethod
- DataMapper::Validations::ValidatesWithin
- DataMapper::Validations::ValidationErrors
- DataMapper::Validations::WithinValidator
- Object

No matching classes.

# DataMapper::Validations::ValidatesConfirmation

### Public Instance Methods

validates_confirmation_of(*fields) click to toggle source

Validates that the given attribute is confirmed by another attribute. A common use case scenario is when you require a user to confirm their password, for which you use both password and password_confirmation attributes.

@option [Boolean] :allow_nil (true)

    true or false.

@option [Boolean] :allow_blank (true)

    true or false.

@option [Symbol] :confirm (firstattr_confirmation)

    The attribute that you want to validate against.

@example Usage

    require 'dm-validations'

    class Page
      include DataMapper::Resource

      property :password, String
      property :email, String
      attr_accessor :password_confirmation
      attr_accessor :email_repeated

      validates_confirmation_of :password
      validates_confirmation_of :email, :confirm => :email_repeated

      # a call to valid? will return false unless:
      # password == password_confirmation
      # and
      # email == email_repeated

    # File lib/dm-validations/validators/confirmation_validator.rb, line 83
    def validates_confirmation_of(*fields)
      validators.add(ConfirmationValidator, *fields)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.