Ember assigns the id of the created post

I create a new user with this:

var transaction = App.store.transaction();
transaction.createRecord(App.User, {
    firstName: this.get('firstName'),
    lastName: this.get('lastName')
});
transaction.commit();

      

my server is coming back

{"first_name":"Han","last_name":"Solo","id":"19"}

      

but the new user id is null. Either I am not returning the correct result from the server, or another step I need to take to assign a new user ID.

+3


source to share


1 answer


Your server should rather return the following json string.



{"user":{"first_name":"Han","last_name":"Solo","id":"19"}}

      

+2


source







All Articles