trailblazer / formular

Form builder for Ruby. Fast, Furious, and Framework-Agnostic.
MIT License
81 stars 17 forks source link

Correct display of nested error messages #51

Open richard-kramer opened 6 years ago

richard-kramer commented 6 years ago

when validating this required(:activity_ids).filled(:array?) { each(:int?, :activity_exists?) } I get the following error hash, if the provided activity_id does not exist: {:activity_ids=>[[0, ["This activity does not exist."]]]} formular displays this as [0, ["This activity does not exist."]] below my form field (btw, 0 is not the provided, wrong ID, but the index of the wrong ID in the activity_ids hash)

fran-worley commented 6 years ago

@richard-kramer Good spot. I'll have to have a think about this one as a solution will need to be configurable as I doubt ActiveModel validations come through in the same format.

As a side point, I think you can do required(:activity_ids).filled(:array?).each(:int?, :activity_exists?) rather than needing the the block...

richard-kramer commented 6 years ago

required(:activity_ids).filled(:array?).each(:int?, :activity_exists?) this was the way, I had it before, but the each part always got skipped

fran-worley commented 6 years ago

Fair enough. The block it is :)