"ember-cli": "0.2.7" "ember": "1.12.0", "ember-data": "1.0.0-beta.18"
I have defined a many to many relationship between my users and teams. Also, I have a relationship from my accounts to my teams (this is a one to many).
// user model js
teams: hasMany('team', {async: true})
// team model js
users: hasMany('user', { async: true }),
account: belongsTo('account', { async: true })
// account model js
teams: hasMany('team', { async: true })
I have a pod for showing an account and its associated teams. This works well but the problem I have is not being able to get my associated users of every team in my teams. It simply does not do anything at all.
// app / pods / teams / index / route.js
export default AuthenticationRoute.extend({
access: ['admin', 'instructor'],
model: function() {
return this.store.find('account', this.auth.get('currentUser.accountId'));
}
});
// app / pods / teams / index / controller.js
export default Ember.Controller.extend({
});
// snippet from app / pods / teams / index / templabe.hbs
<tr>
<td width="25%"></td>
<td width="20%"></td>
<td width="15%"></td>
<td width="40%"></td>
</tr>
So the team.users.length are always returning 0 and it does not do a query at all like I am experiencing with teams on account (model.teams).
It has been working previously but after refactorization it has changed and I simply cannot figure out my problem.
Looking forward to your answers and help!
Aucun commentaire:
Enregistrer un commentaire