Class: StoreModel::CombineErrorsStrategies::MergeArrayErrorStrategy
- Inherits:
-
Object
- Object
- StoreModel::CombineErrorsStrategies::MergeArrayErrorStrategy
- Defined in:
- lib/store_model/combine_errors_strategies/merge_array_error_strategy.rb
Overview
MergeArrayErrorStrategy
copies errors from the StoreModel::Model to the parent record attribute errors.
Instance Method Summary collapse
-
#call(attribute, base_errors, store_models) ⇒ Object
Merges errors on
attribute
from the child model with parent errors.
Instance Method Details
#call(attribute, base_errors, store_models) ⇒ Object
Merges errors on attribute
from the child model with parent errors.
13 14 15 16 17 18 19 |
# File 'lib/store_model/combine_errors_strategies/merge_array_error_strategy.rb', line 13 def call(attribute, base_errors, store_models) store_models.each_with_index do |store_model, index| store_model.errors..each do || base_errors.add(attribute, :invalid, message: "[#{index}] #{}") end end end |