module Marten::Core::Validation
Overview
Provides validation to objects.
Direct including types
Defined in:
marten/core/validation.crmarten/core/validation/callbacks.cr
marten/core/validation/error.cr
marten/core/validation/error_set.cr
Instance Method Summary
-
#errors : ErrorSet
Returns the error set containing the errors generated during a validation.
-
#invalid?(context : Nil | String | Symbol = nil)
Returns a boolean indicating whether the object is invalid.
-
#valid?(context : Nil | String | Symbol = nil)
Returns a boolean indicating whether the object is valid.
-
#validate
Allows to run custom validations for the considered object.
Macro Summary
-
validate(*names)
Registers validation methods.
Instance Method Detail
Returns the error set containing the errors generated during a validation.
Returns a boolean indicating whether the object is invalid.
An optional context can be specified using the context
argument. When this option is used, additional
validation rules that explicitly require a specific context might run.
Returns a boolean indicating whether the object is valid.
An optional context can be specified using the context
argument. When this option is used, additional
validation rules that explicitly require a specific context might run.
Allows to run custom validations for the considered object.
By default this method is empty and does nothing. It should be overridden in the specific class at hand in order to implement custom validation logics.