Class Index [+]

Quicksearch

DataMapper::Validations::ValidatesAbsence

Public Instance Methods

validates_absence_of(*fields) click to toggle source

Validates that the specified attribute is “blank” via the attribute’s # method.

@note

  dm-core's support lib adds the #blank? method to many classes,

@see lib/dm-core/support/blank.rb (dm-core) for more information.

@example [Usage]

  require 'dm-validations'

  class Page
    include DataMapper::Resource

    property :unwanted_attribute, String
    property :another_unwanted, String
    property :yet_again, String

    validates_absence_of :unwanted_attribute
    validates_absence_of :another_unwanted, :yet_again

    # a call to valid? will return false unless
    # all three attributes are blank
  end
    # File lib/dm-validations/validators/absent_field_validator.rb, line 51
51:       def validates_absence_of(*fields)
52:         validators.add(AbsenceValidator, *fields)
53:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.