Implemented destroyAll for sub-scopes

This commit is contained in:
Taner Topal 2012-03-21 12:12:13 +01:00
parent ff65e3a7ad
commit 07edcdce22
1 changed files with 11 additions and 2 deletions

View File

@ -613,8 +613,17 @@ function defineScope(cls, targetClass, name, params, methods) {
this.build(data).save(cb); this.build(data).save(cb);
} }
function destroyAll(id, cb) { function destroyAll(cb) {
// implement me targetClass.all(this._scope, function (err, data) {
if (err) {
cb(err);
} else {
data.forEach(function (el) {
el.destroy();
});
cb();
}
});
} }
function mergeParams(base, update) { function mergeParams(base, update) {