Class: DataMapper::Validate::ValidationErrors

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

@author Guy van den Berg @since 0.9

### Methods

[] add clear! default_error_message each empty? full_messages method_missing new on

### Included Modules

Enumerable

### Attributes

resource | [R] |

### Public Class methods

default_error_message(key, field, *values)
new(resource)

### Public Instance methods

[](field_name)

Return validation errors for a particular field name or an empty array

This method is a necessary requirement for active_model compatibility.

@param [Symbol] field_name the name of the field you want an error for @return [Array<Array<String>>]

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

add(field_name, message)

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!()

Clear existing validation errors.

each() {|v| ...}
empty?()
full_messages()

Collect all errors into a single list.

method_missing(meth, *args, &block)
on(field_name)

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::Validate::Error>]

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

[Validate]