Ember-Data, 2 models belongTo eachother EmbeddedRecords


#1

Hello there,

This is my first post, here it goes.

I’m unsure if there’s a problem with Ember-Datas’s Adapter when deserializing, the EmberEmbeddedRecord Mixin or if it’s me being a novice.

I setup a fiddle here http://emberjs.jsbin.com/liqixevoja/7/edit?js,output where there are two models where the following problem occurs.

ModelA and ModelB belongTo eachother.

Now when I first create them with this.store.createRecord(…) there’s no problem everything is bound, works like a charm etc.

As soon as I press the Save Models button as you will see I return a mockajax (maybe the response format is wrong) but the association ModelA has with ModelB disappears, but ModelB has it for ModelA.

To view it with Ember Inspector you can visit http://emberjs.jsbin.com/liqixevoja/7

Any ideas?

Thanks in advance for the help!


#2

Ok well I attempted to do the same thing in my application now with sideloading and the invoke(‘unloadRecord’) triggers the same issue.

I haven’t looked at the source code but the sensation I get is that by doing an “unloadRecord” on a belongsTo it gets the related object and unsets the relationship even if the relationship has been overwriten previously by another payload / record.

Can someone confirm this?