Added cascading deletions

This commit is contained in:
Thaum
2015-03-04 10:17:32 +00:00
parent 88dbaccfc5
commit a5068f1bc2
10 changed files with 72 additions and 34 deletions

View File

@@ -22,3 +22,13 @@ SpellLists.helpers({
return num;
}
});
SpellLists.before.remove(function (userId, list) {
if(Meteor.isServer){
Spells.remove({listId: list._id});
} else {
Spells.find({listId: list._id}).forEach(function(spell){
Spells.remove(spell._id);
});
}
});