module

Lustra::Model::HasValidation

Inherits Lustra::Validation::Helper

Instance methods

add_error(column, reason)

Add validation error related to a specific column

Source
add_error(reason)

Add validation error not related to a specific column

Source
clear_errors

Clear the errors log (if any) of the model and return itself

Source
error?

Return true if saving has been declined because of validation issues. The error list can be found by calling Lustra::Model#errors

Source
errors

List of errors raised during validation, in case the model hasn't been saved properly.

Source
valid!

Check whether the model is valid. If not, raise InvalidModelError. Return the model itself

Source
valid?

Return true if the model

Source
validate

This method is called whenever valid? or save is called. By default, validate is empty and must be overriden by your own validation code.

Source

Nested types