@benking wrote:
I've been trying to figure this out for a few hours now and it's driving me crazy!
I simply want to allow Users to follow other Users. My User model looks like this;
export default Model.extend({ name: attr('string'), username: attr('string'), avatar: belongsTo('image'), usersFollowing: hasMany('user') });
When I get to creating a follow, I've tried this;
this.get('session.currentUser').get('usersFollowing').pushObject(userToFollow); this.get('session.currentUser').save();
But that sends down my entire
usersFollowing
array to the server. This won't be scalable. According to the JSONAPI spec, Ember Data should be making a POST request to the/users-following
relationship link with just the data of the new follow.Can anyone help with this? It seems like such a simple thing that I can't get to work
Posts: 1
Participants: 1