Main issue:
When saving the photo, the serialiser fails because the belongsTo relationship is null meaning it can’t access the constructor.

I’m not sure if this is because a) I don’t have my relationships defined properly, or b) ember-data doesn’t keep track of the relationship graph.

If I try setting up the relationship explicitly before saving with photo.set('attachable', profile) then the serialiser still fails because belongsTo.constructor.typeKey is undefined.

** Queries**

Before ember-data 1.0 this save method was much simpler as it used embedded relationships to save the profile and photo together in one API call. However, 1.0 seems to have phased out that type of API access which has resulted in much more complex code - is there a simpler way than constantly checking the success of saves in a chain and manual cleanup of already created relationships if latter saves fail?

Is there anyway to retrieve an actual model from a .get('relationship' call rather than a promise object? I’m finding I’m having to work around this a lot throughout my app.

I’ve found I need to create all of my polymorphic relationship models (attachable, commentable, etc) by extending the previous one in the chain otherwise I end up with errors such as You can only add a 'attachable' record to this relationship. This means every one of my models that uses a polymorphic relationship must include the entire chain even if it only uses one type of polymorphic association. Is there a way to do this with mixins or similar instead so there isn’t such a dependency problem?

I’ve updated the code above to include the other model definitions, maybe it’s clearer to see the extend chain now.

I have read through the transitioning document many times but it appears I’m running into a bug somewhere with the polymorphic support.

It would be really useful to have a cookbook that shows the correct way to handle saving relationships asynchronously where you need to clean up previously created objects if the other side of the relationship fails to save.

For what it’s worth, in my use of Ember Data 1.0 beta 2, I’ve found it absolutely necessary to specify the inverse relationships to get them to work. I don’t use polymorphic joins at all, so it might not be terribly helpful, but that was a major sticking point for me.