MCPcopy Index your code
hub / github.com/dresende/node-orm2 / saveAssociation

Function saveAssociation

lib/Instance.js:278–293  ·  view source on GitHub ↗
(accessor, instances)

Source from the content-addressed store, hash-verified

276 var saveAssociations = function (cb) {
277 var pending = 1, errored = false, i, j;
278 var saveAssociation = function (accessor, instances) {
279 pending += 1;
280
281 instance[accessor](instances, function (err) {
282 if (err) {
283 if (errored) return;
284
285 errored = true;
286 return cb(err, true);
287 }
288
289 if (--pending === 0) {
290 return cb(null, true);
291 }
292 });
293 };
294
295 var _saveOneAssociation = function (assoc) {
296 if (!instance[assoc.name] || typeof instance[assoc.name] !== "object") return;

Callers 2

_saveOneAssociationFunction · 0.70
_saveManyAssociationFunction · 0.70

Calls 1

cbFunction · 0.85

Tested by

no test coverage detected