formular
formular copied to clipboard
Correct display of nested error messages
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 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...
required(:activity_ids).filled(:array?).each(:int?, :activity_exists?)
this was the way, I had it before, but the each
part always got skipped
Fair enough. The block it is :)