samedi 5 mars 2016

Ember 2.2 relationships always null

Can't seem to figure out why my relationships are always null.

app/models/group.js

export default Model.extend({
    originalID: DS.attr('number'),
    name: DS.attr('string'),
    slideshows: DS.hasMany('slideshow', { async: true }),
});

app/models/slideshow.js

export default Model.extend({
    originalID: DS.attr('number'),
    title: DS.attr('string'),
    group: DS.belongsTo('group', { async: true }),
});

Creating some data:

group = self.store.createRecord('group', {
    originalID: 100,
    name: 'Fake Group'
});

group.save();

slideshow = self.store.createRecord('slideshow', {
    originalID: 101,
    title: 'Fake Slideshow',
    group: group
});

slideshow.save();

When I view the document in Pouch DB inspector group is always null. I'm following the guide on Ember's documentation page but it doesn't seem to work?




Aucun commentaire:

Enregistrer un commentaire