(accessor, instances)
| 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; |
no test coverage detected