Getting nested value in error value using Changeset#get
should work
#357
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In v1.6.0, it was possible to get a nested value from the
error
object by usingget
on an instance of Changeset:This returned
undefined
if it wasn't present, and an object with thevalue
andvalidation
if it was.This is not possible in the newest version - it instead returns
undefined
no matter what.By using
git bisect
with this test, I found that this stopped working inv2.0.0-beta.0
.I don't know what the intended behavior here is now, but it seems to me like this at least was intended to work.
For instance, there's an example in the README that uses this too, which also fails since 2.0: https://github.com/poteto/ember-changeset/blob/3d777266a252d352513c6833fe3fc83345da9c90/README.md#tips-and-tricks
This always returns
undefined
and setshasError
tofalse
:The alternative to making this work again is to instead use normal getters:
You could even say this is preferable, I'm merely saying that it used to work and now it doesn't.