Closed Svatok closed 3 years ago
@Svatok That's the expected behaviour. form.errors.messages
gives errors for only the top level properties/collections combined. collection
creates separate reform object which can be iterated over to get their errors, just like has_many
which is also compatible to form_for
or any form tag.
See - https://github.com/trailblazer/reform/blob/master/test/validation/dry_validation_test.rb#L460
Formatting nested errors is upto you as few wants them in array
style or in dotted ("songs.0.title")
style.
Complete Description of Issue
Form returns merged errors for
collection
after validation.Steps to reproduce
Run test:
Expected behavior
Test is passed.
Actual behavior
Test is failed. Form returns merged errors:
{:"songs.title"=>["size cannot be less than 2", "size cannot be greater than 5"]}
System configuration
Reform version: v2.4.0 dry-validation version: v1.5.2