Updating ID after createRecord


#1

I have a Room model

App.Room = DS.Model.extend({
  name         : DS.attr(),
  url          : DS.attr(),
  created_at   : DS.attr(),
  updated_at   : DS.attr(),
  messages: DS.hasMany('message',{async:true})
});

I am saving new records client side like this:

var room =   {name: 'happy day'} ;
this.store.createRecord('room', room).save();

My custom adapter with JSONSerializer is resolving this JSON from the server:

{"user":{"name":"gggg","id":19,"url":"lv"}} 

However, the ID is not being updated upon store.createRecord().

Can you spot anything wrong here?


#2

I changed to

App.ApplicationSerializer = DS.RESTSerializer;

and it works.

Feel free to delete this topic :slight_smile: