Reflexive Association


#1

Hi everyone,

I am trying to implement “follower/following” relationship.

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

 {{#each model as |user|}}
    ...
    <button {{action 'follow' user}}>Follow</button>
 {{/each}}

 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;

Could you guys help me solve the problem, please.TIA