Has anyone gotten Ember to work with Reflexive relationships? I’m using ember-data-1.0.0.beta.7 with ActiveModelAdapter and Rails. My model looks like:
App.Foobar = DS.model.extend({
name: DS.attr('string'),
ancestor: DS.belongsTo('foobar'),
descendants: DS.hasMany('foobar')
});
and the returned JSON looks like:
{
"foobar": {"id": 2, "name": "lorem"},
"descendants": [
{"id": 3, "name": "John"},
{"id": 4, "name": "Smith"}
],
"ancestor": {"id": 6, "name": "ipsum"}
}
I believe the JSON format is what is described in the documentation, but I wouldn’t be surprised if there’s something amiss. I also tried turning async to false and I still got the same error.
This is the error I got:
"Error while loading route: Ember.Error@http://localhost:3000/assets/ember.js?body=1:837
Store<.modelFor@http://localhost:3000/assets/ember-data.js?body=1:9806
RESTSerializer<.extractSingle@http://localhost:3000/assets/ember-data.js?body=1:3019
superWrapper@http://localhost:3000/assets/ember.js?body=1:1231
JSONSerializer<.extractFind@http://localhost:3000/assets/ember-data.js?body=1:2481
JSONSerializer<.extract@http://localhost:3000/assets/ember-data.js?body=1:2366
_find/<@http://localhost:3000/assets/ember-data.js?body=1:10338
invokeCallback@http://localhost:3000/assets/ember.js?body=1:9428
publish@http://localhost:3000/assets/ember.js?body=1:9098
publishFulfillment@http://localhost:3000/assets/ember.js?body=1:9518
DeferredActionQueues.prototype.flush@http://localhost:3000/assets/ember.js?body=1:5651
Backburner.prototype.end@http://localhost:3000/assets/ember.js?body=1:5742
Backburner.prototype.run@http://localhost:3000/assets/ember.js?body=1:5781
Ember.run@http://localhost:3000/assets/ember.js?body=1:6182
RESTAdapter<.ajax/< /hash.success@http://localhost:3000/assets/ember-data.js?body=1:1524
jQuery.Callbacks/fire@http://localhost:3000/assets/jquery.js?body=1:3049
jQuery.Callbacks/self.fireWith@http://localhost:3000/assets/jquery.js?body=1:3161
done@http://localhost:3000/assets/jquery.js?body=1:8236
.send/callback@http://localhost:3000/assets/jquery.js?body=1:8779
"
And in the Ember Inspector it tells me a promise was rejected because the model wasn’t found.
Any help would be greatly appreciated.