I have a user object that is loaded into the session at session.user
. The user can be assigned many roles. Here's what that looks like on the model:
App.User = DS.Model.extend({
roles : DS.hasMany('role'),
...
}
The roles are loaded with the user as embedded records. I can verify they are being successfully loaded into the ember-data store and the relationship between the user and the role is all good.
What I'd like to be able to do, is get one of the user's role based upon a role property. I've tried
this.get('session.user.roles').then(function (roles) {
return roles.filterBy('propertyName', 'propertyValue');
});
but I don't believe the get method returns a promise like the store.find() method does. What methods are provided to me to filter the roles?