mercredi 11 janvier 2017

Ember.Js Reflexive Association

I am trying to implement "follower/following" relationship.

app/templates/users.hbs---------------------------


   ...
  <button >Follow</button>


app/routes/users.js---------------------------

 follow(user){
   //currentUser is the one clicking on 'follow' button 
   //and it works.I can successfully alert it's properties.
   currentUser.get('followings').pushObject(user);
 },

app/models/user.js----------------------- ... followings: DS.hasMany('user',{inverse: null}), followers: DS.hasMany('user',{inverse: null}),

Now, this solution is causing this error below;

Uncaught TypeError: Cannot read the property 'modelName' of undefined at assertPolymorphicType.notifyRecordRelationshipAdded




Aucun commentaire:

Enregistrer un commentaire