mercredi 13 mars 2019

Fetching data from other model Ember

I have a user model

export default DS.Model.extend({
    username : DS.attr('string'),
    numberOfQuotes: DS.attr('number'),
    numberOfFollowers: DS.attr('number'),
    numberOfFollowing: DS.attr('number')
});

and a quotes model

export default DS.Model.extend({
user: DS.belongsTo('user'),
text: DS.attr('string')
});

And i am getting quotes which also includes the user id and for this i am using

quotes :this.store.findAll('quote') But i am unable to get the user object so i am unable to retreive the data. Any help will work thanks.




Aucun commentaire:

Enregistrer un commentaire