不要怂,就是干,撸起袖子干!

Commit a36e63f8 by Sascha Depold

wait for the unset queries

1 parent 8b19fc59
Showing with 3 additions and 4 deletions
......@@ -18,16 +18,15 @@ module.exports = (function() {
HasManySingleLinked.prototype.injectSetter = function(emitter, oldAssociations, newAssociations) {
var self = this
, options = this.__factory.options
, chainer = new Utils.QueryChainer()
// clear the old associations
oldAssociations.forEach(function(associatedObject) {
associatedObject[self.__factory.identifier] = options.omitNull ? '' : null
associatedObject.save()
chainer.add(associatedObject.save())
})
// set the new one
var chainer = new Utils.QueryChainer()
// set the new associations
newAssociations.forEach(function(associatedObject) {
associatedObject[self.__factory.identifier] = self.instance.id
chainer.add(associatedObject.save())
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!