mardi 11 août 2015

Ember get related record in ember-data 1.13.8

Pre ember-data 1.13.8 I was able to get related records with the following syntax (this is inside of a component to comply with embers move from views):

var user = this.get('user') // The user model is passed through to the component
var classifications = user.get("Classifications"); // This would be the related records

However in ember 1.13.8 classifications is now undefined whereas before it was an array of related records. I have followed the transition guide but can't seem to find a reference to this change.

My user model looks like this:

export default DS.Model.extend({
    User: DS.attr('string'),
    Email: DS.attr('string'),
    PCTID: DS.attr('number'),
    Classifications: DS.hasMany('classification'),
    UserClassification: DS.attr(),
});

and my classification model looks like this:

export default DS.Model.extend({
    Classification: DS.attr('string'),
    PostedBy: DS.attr('string'),
    DatePosted: DS.attr('isodate'),
    Bulletin: DS.attr('string'),
    ExpireDate: DS.attr('isodate'),
    Title: DS.attr('string'),
    UserRole: DS.attr(),
});

How should I be getting the related records in ember-data 1.13.8?

Aucun commentaire:

Enregistrer un commentaire