formular icon indicating copy to clipboard operation
formular copied to clipboard

Correct display of nested error messages

Open richard-kramer opened this issue 7 years ago • 3 comments

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)

richard-kramer avatar Dec 11 '17 10:12 richard-kramer

@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...

fran-worley avatar Dec 11 '17 10:12 fran-worley

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

richard-kramer avatar Dec 11 '17 10:12 richard-kramer

Fair enough. The block it is :)

fran-worley avatar Dec 11 '17 10:12 fran-worley