Class Index [+]

Quicksearch

DataMapper::Validations::ValidatesPrimitiveType

Public Instance Methods

validates_primitive_type_of(*fields) click to toggle source

Validates that the specified attribute is of the correct primitive type.

@example Usage

  require 'dm-validations'

  class Person
    include DataMapper::Resource

    property :birth_date, Date

    validates_primitive_type_of :birth_date

    # a call to valid? will return false unless
    # the birth_date is something that can be properly
    # casted into a Date object.
  end
    # File lib/dm-validations/validators/primitive_validator.rb, line 51
51:       def validates_primitive_type_of(*fields)
52:         validators.add(PrimitiveTypeValidator, *fields)
53:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.