Open albsierra opened 7 years ago
Sorry.
It was easier to check if destroyAll method exist in model, in lib/fixtures-loader.js, than the previous solution.
purgeDatabase: function(models) {
var purgeModelPromises;
purgeModelPromises = [];
_.forEach(models, (function(_this) {
return function(model) {
if(model.destroyAll)
return purgeModelPromises.push(_this.purgeModel(model));
};
})(this));
return Promise.all(purgeModelPromises);
},
I have an Email model whose base model isn't PersistedModel. Therefore, when I try to load fixtures it return an error "model.destroyAll is not a function".
I modified load-fixtures.js to filter models derived from PersistedModel and sending
models
instead ofapp.models
. It works for me.