error.parentAttribute is not a string
Declared as string here https://github.com/offirgolan/ember-cp-validations/blob/master/addon/validations/error.js#L33
{{#each formModel.validations.errors as |error|}}
<li>{{error.parentAttribute}} - {{error.attribute}} - {{error.message}}</li>
{{/each}}
Model:<(unknown mixin):ember1701> - emailAddress - Deze waarde moet een geldig e-mail adres bevatten
Model:<(unknown mixin):ember1701> - addressDelivery.street - Deze waarde mag niet leeg zijn
Model:<(unknown mixin):ember1701> - addressDelivery.populatedPlace - Deze waarde mag niet leeg zijn
Model:<(unknown mixin):ember1701> - addressDelivery.postalCode - Deze waarde mag niet leeg zijn
Model:<(unknown mixin):ember1701> - addressDelivery.country - Deze waarde mag niet leeg zijn
Model:<(unknown mixin):ember1701> - addressVisiting.street - Deze waarde mag niet leeg zijn
Model:<(unknown mixin):ember1701> - addressVisiting.populatedPlace - Deze waarde mag niet leeg zijn
Model:<(unknown mixin):ember1701> - addressVisiting.postalCode - Deze waarde mag niet leeg zijn
Model:<(unknown mixin):ember1701> - addressVisiting.country - Deze waarde mag niet leeg zijn
In this instance I'm trying to validate an emailAddress is a polymorphic model (fragment) of a primaryContact property on the base model. Its property 'path' is more like 'primaryContact.[index].emailAddress. I'm juggling forms inside form, so it might be the path 'emailAddress' error comes from there. I was hoping to use the parentAttribute for some checks.
@basz I believe parentAttribute is only set for nested validations. Usually when used via a belongsTo or hasMany.
That would seem logical. Yet it is not a string...
Oh.... what is it then?
Dunno, an unknown mixin? See above? Probably the parent model. But not a string as the api docs say. Attribute on the other hand is. So in combinating both one should be able to create a full path...
Any chance you can make a twiddle to reproduce this?
I'm facing a similar issue, parentAttribute is a string but is like "Model:<(unknown):ember333>"
Very simple reproduction here: https://ember-twiddle.com/a863a3cbd1e43164669f3aebb5cfdad9?openFiles=templates.application.hbs%2C
Maybe I'm doing something wrong? Is the intention for parentAttribute to equal "post" in the above twiddle's case?
edit:
Looks like parentAttribute is set here and the ResultCollections attribute is set here via
attribute: `Model:${this}`
Would setting this to the parents model name make more sense for nested validations?