Use previousAttributes when model is destroyed

fixes #5589
This commit is contained in:
Fabian Becker 2015-07-20 14:20:43 +02:00
parent 27ecb3b211
commit 4500b14989
2 changed files with 4 additions and 1 deletions

View File

@ -136,6 +136,10 @@ _.extend(BaseSiteMapGenerator.prototype, {
removeUrl: function (model) {
var datum = model.toJSON();
// When the model is destroyed we need to fetch previousAttributes
if (!datum.id) {
datum = model.previousAttributes();
}
this.removeFromLookups(datum);
this.lastModified = Date.now();

View File

@ -107,7 +107,6 @@ Post = ghostBookshelf.Model.extend({
if (model.previous('status') === 'published') {
model.emitChange('unpublished');
}
model.emitChange('deleted');
});
},