Module: DataMapper::Validations::ClassMethods

### Home Classes Methods

### In Files

- lib/dm-validations.rb

### Methods

- #create
- #inherited
- #validators

### Included Modules

- DataMapper::Validations::ValidatesPresence
- DataMapper::Validations::ValidatesAbsence
- DataMapper::Validations::ValidatesConfirmation
- DataMapper::Validations::ValidatesPrimitiveType
- DataMapper::Validations::ValidatesAcceptance
- DataMapper::Validations::ValidatesFormat
- DataMapper::Validations::ValidatesLength
- DataMapper::Validations::ValidatesWithin
- DataMapper::Validations::ValidatesNumericality
- DataMapper::Validations::ValidatesWithMethod
- DataMapper::Validations::ValidatesWithBlock
- DataMapper::Validations::ValidatesUniqueness
- DataMapper::Validations::AutoValidations

### 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::ClassMethods

### Public Instance Methods

create(attributes = {}, *args) click to toggle source

@api public

    # File lib/dm-validations.rb, line 128
    def create(attributes = {}, *args)
      resource = new(attributes)
      resource.save(*args)
      resource
    end

inherited(base) click to toggle source

@api private

    # File lib/dm-validations.rb, line 117
    def inherited(base)
      super
      self.validators.contexts.each do |context, validators|
        validators.each do |v|
          options = v.options.merge(:context => context)
          base.validators.add(v.class, v.field_name, options)
        end
      end
    end

validators() click to toggle source

Return the set of contextual validators or create a new one

@api public

    # File lib/dm-validations.rb, line 112
    def validators
      @validators ||= ContextualValidators.new(self)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.