ember-changeset-cp-validations
ember-changeset-cp-validations copied to clipboard
Validation is marking fields as changed
I have a model with two validations, a custom one and a has-many one.
Now, when using a changeset and changing a value, I get the following changes:
changeset.get('changes'); // -->[ {...} ]
However, when I then run changeset.validate()
, suddenly I get both fields that have validation on them as well:
changeset.validate().then(() => {
console.log(changeset.get('changes')); // --> [ {...}, {...}, {...}]
});
The fields are only added after calling .validate()
. I'm creating the changeset like this:
createChangeset(myModel)
.
If I manually do this check:
changeset.get('change.validatedField') === model.get('validatedField')
it returns true, indicating that it indeed hasn't changed at all.
@mydea I'm actually not too sure whats going on here. All this addon does is provide a validate function for ember-changeset to test values against. It has nothing to do with the change detection.