When I invoke
App.store.createRecord(App.User, { name: this.get("name") });
App.store.commit();
how do I know if its successful and how to wait for the asyn message?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Very limited error handling was recently added to DS.RESTAdapter in ember-data master.
When creating or updating records (with bulk commit disabled) and a status code between 400 and 599 is returned, the following will happen:
A
422 Unprocessable Entitywill transition the record to the “invalid” state and will add any errors returned from the server to the record’serrorsproperty.The adapter assumes the server will respond with JSON in the following format:
(The error messages themselves could be arrays of strings or just strings. ember-data doesn’t currently care which.)
To detect this state:
All other status codes will transition the record to the “error” state.
To detect this state, use:
More cases may eventually be handled by ember-data out of the box, but for the moment if you need something specific, you’ll have to extend
DS.RESTAdapter, customizing itsdidErrorfunction to add it in yourself.