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

Commit 4be6547c by sdepold

fixed missing options

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