Module: Kangaru::Validatable
Instance Method Summary
collapse
Methods included from Concern
append_features, class_methods, included
Instance Method Details
#errors ⇒ Object
16
17
18
|
# File 'lib/kangaru/concerns/validatable.rb', line 16
def errors
@errors ||= []
end
|
#valid? ⇒ Boolean
24
25
26
27
28
|
# File 'lib/kangaru/concerns/validatable.rb', line 24
def valid?
validate
errors.empty?
end
|
#validate ⇒ Object
20
21
22
|
# File 'lib/kangaru/concerns/validatable.rb', line 20
def validate
model_validator.validate!(**self.class.validation_rules)
end
|