Skip to content

Clear relationship errors on invalid records when relationships are updated #826

wants to merge 1 commit into from

2 participants

ghost commented Mar 21, 2013

When a record is made invalid by the adapter the errors object is set on the model, with the model attributes that are in error. Once the attributes in error are corrected, they are removed from the errors object.

However this is not the case for attributes that represent a relationship. Once these attributes are set in the error object, updating them will not remove them.

I provided an example with this ticket (#764) but fear that my explanation of the issue was not clear.

My proposed solution is to alter the invalid state, moving the error clearing from didSetProperty to becomeDirty, which is called by both relationship and attribute changes and thereby clearing attributes from the error object when a change occurs.

bobbus commented Mar 21, 2013

@everwakeful , I make another proposal to hanle invalid states with embedded records, could you look at #682 and let me know what you think. I'm not sure what will be the preferable solution.

bobbus commented Mar 21, 2013

@everwakeful , After looking further into your solution I understand that the PR request #682, does not answer to the same problem even if they are related.
I really like the solution you have for errors on relationship that when there is errors on a relationship field, they will be cleared when we modify the relationship.

Ember.js member
wagenet commented Aug 10, 2013

@everwakeful This doesn't merge cleanly and also doesn't include tests. I'm going to close it for now leaving #764 open. If you want to pursue more work on it, please let us know.

@wagenet wagenet closed this Aug 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.