Ancestry / belongsTo Itself

Is there anyway in Ember Data to have a model ‘belongTo itself’? And if not currently, would that be a worthy addition?

For example, I am working with a groups concept where if a user is in Group 1, they are also in the larger Group 2.

Here’s a JSBin of what I think seems like a decent Ember Data concept.

http://emberjs.jsbin.com/deheto/2/edit?js,output

Here is what I manually did to get it working.

http://emberjs.jsbin.com/kiliv/1/edit?js,output

I’d appreciate any other ideas…

1 Like

The thing you’re talking about is called a “Self-Join.” I found an old SO thread that offers a workaround. I almost never use these kinds of relationships, but I agree that it would be cool to have some native support for it.