lulalala/adequate_errors

Merge errors from other models and keep details

lulalala opened this issue · 1 comments

Sometimes it is desired to merge errors from associations or child models. For example form objects need to merge validation errors from its child models.

However, if we are to merge, it may not be possible to copy across the details and message at the same time. If we merely copied the details, those details in the form object probably won't be able to generate messages, because it does not have corresponding locale translations on form object scope.

That leaves us having to copy across the full messages only, losing details.

An example of this is in ActiveInteraction https://github.com/AaronLasseigne/active_interaction/blob/v4.0.0/lib/active_interaction/errors.rb#L136-L143

This can be solved by introducing the idea of nested error object.

Also solved by SHA b4ee77e