Class DataMapper::Validations::ValidationErrors
In: lib/dm-validations/validation_errors.rb
Parent: Object

@author Guy van den Berg @since 0.9

Methods

Included Modules

Enumerable

Attributes

resource  [R] 

Public Class methods

Holds a hash with all the default error messages that can be replaced by your own copy or localizations.

Public Instance methods

Add a validation error. Use the field_name :general if the errors does not apply to a specific field of the Resource.

@param [Symbol] field_name

  The name of the field that caused the error

@param [String] message

  The message to add

Clear existing validation errors.

Collect all errors into a single list.

Return validation errors for a particular field_name.

@param [Symbol] field_name

  The name of the field you want an error for.

@return [Array<DataMapper::Validations::Error>]

  Array of validation errors or empty array, if there are no errors
  on given field

[Validate]