You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have customized the REST adapter so that I can catch backend errors using the store.recordWasInvalid method in ajax error callback.
When I do this:
// called before in other moment// var user = App.store.find(App.User, "1"); // user.get("transaction") === App.store.get("defaultTransaction")vart=App.store.transaction();t.add(user);// App.user.get('transaction') === t// set an invalid nameuser.set("name"," ");// do committ.commit();
The server respond with 422 http status code and the model go to loaded.updated.invalid state after the adapter call store.recordWasInvalid. Then I set a valid value:
When I set a valid value and the record not have any errors, change its state from loaded.updated.invalid to loaded.updated.uncommited. Internally, in the state manager, the state loaded.updated.invalid has the exit property defined and inside perform the deletion of current transaction and translate the record to the store default transaction.
As the record has changed fields can not be moved to a new transaction. In this case, the solution would not move the record from the current transaction, allowing transaction to be commited again.
I have customized the REST adapter so that I can catch backend errors using the
store.recordWasInvalid
method in ajax error callback.When I do this:
The server respond with 422 http status code and the model go to
loaded.updated.invalid
state after the adapter callstore.recordWasInvalid
. Then I set a valid value:When I set a valid value and the record not have any errors, change its state from
loaded.updated.invalid
toloaded.updated.uncommited
. Internally, in the state manager, the stateloaded.updated.invalid
has theexit
property defined and inside perform the deletion of current transaction and translate the record to the store default transaction.As the record has changed fields can not be moved to a new transaction. In this case, the solution would not move the record from the current transaction, allowing transaction to be commited again.
Related issue in stackOverflow: http://stackoverflow.com/questions/11054868/whats-the-standard-pattern-for-ember-data-validations-invalid-state-becamein
The text was updated successfully, but these errors were encountered: