Module: Filterameter::Errors
- Included in:
- DeclarationsValidator, Filters::ArelFilter, Filters::AttributeFilter, Filters::ConditionalScopeFilter, Filters::MatchesFilter, Filters::NestedFilter, Filters::ScopeFilter, Sorts::AttributeSort
- Defined in:
- lib/filterameter/errors.rb
Overview
# Errors
Module Errors provides ‘valid?` and `errors` to implementing classes. If the `valid?` method is not overridden, then it returns true.
To provide validations rules, override ‘validate`. If any fail, populate the errors attribute with the reason for the failures.
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
12 13 14 |
# File 'lib/filterameter/errors.rb', line 12 def errors @errors end |
Instance Method Details
#valid?(model = nil) ⇒ Boolean
14 15 16 17 18 |
# File 'lib/filterameter/errors.rb', line 14 def valid?(model = nil) @errors = [] validate(model) @errors.empty? end |