adopted-ember-addons / ember-validators

A collection of EmberJS validators
Other
24 stars 40 forks source link

Nested `ds-error` validations don't work anymore #110

Closed herzzanu closed 2 years ago

herzzanu commented 2 years ago

It looks like the ds-error validatior stopped working for nested errors. I assume this https://github.com/offirgolan/ember-validators/commit/f829984c8c28152f6e15d0b091308583fb1ac997 might have broken it.

The fix is most likely on this line https://github.com/offirgolan/ember-validators/commit/f829984c8c28152f6e15d0b091308583fb1ac997#diff-ca376f14c1cb0e5696506e00be4f0fa42e7212370c4b5e5bb8eef4970fdcdfceL25

In this case model[path] would work if the path is a simple key like errors. However, if the path is a nested key like foo.errors it won't work. We could fix this by doing model.get(path).

@snewcomer let me know if this is good for you and I can go ahead and create a PR.

snewcomer commented 2 years ago

That sounds great! get(model, path)

herzzanu commented 2 years ago

Thanks for the quick reply @snewcomer Here's the PR https://github.com/offirgolan/ember-validators/pull/111