Class Misago\ActiveRecord\Errors

Handles errors for a given record.

FIXME: Base error messages should be translated.

Methods

Public instance methods

__construct($model=null)

__toString()

add($attribute, $msg=':invalid')

Adds an error message for the associated record's attribute. The attribute is now marked as invalid.

add_on_blank($attribute)

Shortcut for add($attribute, ':blank').

add_on_empty($attribute)

Shortcut for add($attribute, ':empty').

add_to_base($msg)

Adds an error message not related to a particular attribute.

clear()

Clears all error messages. All attributes are now considered valid.

count()

Counts how many error messages there are.

full_messages()

Returns the full list of error messages.

is_empty()

Returns true if all attributes are valid and no error message was added.

is_invalid($attribute)

Returns true if associated record attribute is invalid.

on($attribute)

Returns error messages for associated record attribute. Returns null if there is no error.

TODO: Add count interpolation variable for validate_length_of().

on_base()

Returns error messages for associated record (not related to a particular attribute).

to_json()

to_xml()