lundi 9 mai 2016

Can't delete reference many to many in ember/firebase

I have a many to many relationship with this models in ember/firebase

model/video
export default Model.extend({
   ...
   tags: hasMany('tag', {async: true}),
   ...
});

model/tag

export default Model.extend({
  ...
  videos: hasMany('video', {async: true})
});

In controller have a delete action

delete(tag) {
  var videos = tag.get('videos');

  tag.destroyRecord().then(() =>{
    videos.map((video) => {
      video.save();
    });
  });
}

This action delete a tag record, but no in reference in video. When tag is delet videos var update to empty. How can i delete reference??




Aucun commentaire:

Enregistrer un commentaire