Sideload same model as requested


#1

When loading single record (e.g., /users/1), it currently seems impossible to sideload other instances of the same model.

For example, if I have model User who has followers (hasMany with same model), ember data throws exception “Uncaught Error: assertion failed: Your server returned a hash with the key users but you have no mapping for it” when requesting user record (/users/1). Is this intended behaviour or a bug? And there a workaround available?

Thanks!


#2

Just a thought but couldnt you extend the model with a different name and sideload with that different name? This assumes you provide an array of User_Ids in the returning JSON.

App.Follower = App.User.extend({
     follows: DS.hasMany("App.User")
});

I mean you need to provide the relationship anyway right. Or am I completely off on extending your own Ember models?