I have two models:
App.User = DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
phoneNumber: DS.attr('string'),
studies: DS.hasMany('study', {async: true})
});
App.Study = DS.Model.extend({
name: DS.attr('string'),
description: DS.attr('string'),
});
I want to un-assign some Studies from a User.
When the user presses the un-assign button in the view, there is an action inside the controller which runs this code:
actions: {
//...
unassign: function(study){
this.get('user').get('studies').removeObject(study);
this.get('user').save();
}
//...
}
This removes the studyId from the users.studies list, but it also removes that study completely from Ember's store.
How can I just un-assign the study from the user.studies , but keep the studies table unaffected.
I'm using:
Ember VERSION = '1.5.1';
Ember-Data Version = 1.0.0-beta.6
Aucun commentaire:
Enregistrer un commentaire