I’m struggling to figure out how I need to structure my I18n YML file in order for custom array rule keys to be picked up. For example:
params do
required(:people).filled(:array)
end
rule(:people).each do
key.failure(:invalid_person) if person_invalid?
end
I tried to structure my I18n file as such (with all the correct namespaces and backends configured in the contract of course):
en:
dry_validations:
errors:
my_contract:
rules:
people:
invalid_person: 'Something'
but I get an error that dry-validation can’t find the invalid_person
key under people.0
. I can make it work by moving the invalid_person
key directly under my_contract
(I guess relying on fallback behaviour), but it doesn’t seem quite right.
Any help would be appreciated!