Module DataMapper::Validate::ClassMethods
In: lib/dm-validations.rb

Methods

Included Modules

DataMapper::Validate::ValidatesPresent DataMapper::Validate::ValidatesAbsent DataMapper::Validate::ValidatesIsConfirmed DataMapper::Validate::ValidatesIsPrimitive DataMapper::Validate::ValidatesIsAccepted DataMapper::Validate::ValidatesFormat DataMapper::Validate::ValidatesLength DataMapper::Validate::ValidatesWithin DataMapper::Validate::ValidatesIsNumber DataMapper::Validate::ValidatesWithMethod DataMapper::Validate::ValidatesWithBlock DataMapper::Validate::ValidatesIsUnique DataMapper::Validate::AutoValidate

Public Instance methods

Create a new validator of the given klazz and push it onto the requested context for each of the attributes in the fields list @param [Hash] opts

   Options supplied to validation macro, example:
   {:context=>:default, :maximum=>50, :allow_nil=>true, :message=>nil}

@param [Array<Symbol>] fields

   Fields given to validation macro, example:
   [:first_name, :last_name] in validates_present :first_name, :last_name

@param [Class] klazz

   Validator class, example: DataMapper::Validate::LengthValidator

Given a new context create an instance method of valid_for_<context>? which simply calls valid?(context) if it does not already exist

Clean up the argument list and return a opts hash, including the merging of any default opts. Set the context to default if none is provided. Also allow :context to be aliased to :on, :when & group

Return the set of contextual validators or create a new one

[Validate]