module Clear::Model::HasValidation
Included Modules
Direct including types
Defined in:
clear/model/modules/has_validation.crInstance Method Summary
-
#add_error(column, reason)
Add validation error related to a specific column
-
#add_error(reason)
Add validation error not related to a specific column
-
#clear_errors
Clear the errors log (if any) of the model and return itself
-
#error?
Return
true
if saving has been declined because of validation issues. -
#errors : Array(Error)
List of errors raised during validation, in case the model hasn't been saved properly.
-
#print_errors
Print the errors in string.
-
#valid!
Check whether the model is valid.
-
#valid?
Return
true
if the model -
#validate
This method is called whenever
#valid?
orsave
is called.
Macros inherited from module Clear::Validation::Helper
ensure_than(field, message, &block)
ensure_than,
on_presence(*fields, &block)
on_presence
Instance Method Detail
Return true
if saving has been declined because of validation issues.
The error list can be found by calling Clear::Model#errors
List of errors raised during validation, in case the model hasn't been saved properly.
Check whether the model is valid. If not, raise InvalidModelError
.
Return the model itself