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

Commit dee58c69 by Jan Aagaard Meier

Fix logging for has many setter

1 parent 965f2ee7
......@@ -62,8 +62,6 @@ module.exports = (function() {
};
HasManyDoubleLinked.prototype.injectSetter = function(oldAssociations, newAssociations, defaultAttributes) {
defaultAttributes = defaultAttributes || {};
var self = this
, targetAssociation = self.association.targetAssociation
, foreignIdentifier = self.association.foreignIdentifier
......
......@@ -38,7 +38,7 @@ module.exports = (function() {
, updateWhere
, associationKeys = Object.keys((oldAssociations[0] || newAssociations[0] || {Model: {primaryKeys: {}}}).Model.primaryKeys || {})
, associationKey = (associationKeys.length === 1) ? associationKeys[0] : 'id'
, options = {}
, options = defaultAttributes
, promises = []
, obsoleteAssociations = oldAssociations.filter(function(old) {
return !Utils._.find(newAssociations, function(obj) {
......@@ -52,10 +52,6 @@ module.exports = (function() {
})
, update;
if ((defaultAttributes || {}).transaction instanceof Transaction) {
options.transaction = defaultAttributes.transaction;
}
if (obsoleteAssociations.length > 0) {
// clear the old associations
var obsoleteIds = obsoleteAssociations.map(function(associatedObject) {
......
......@@ -403,6 +403,8 @@ module.exports = (function() {
, primaryKeyAttribute = association.target.primaryKeyAttribute;
obj[this.accessors.set] = function(newAssociatedObjects, additionalAttributes) {
additionalAttributes = additionalAttributes || {};
if (newAssociatedObjects === null) {
newAssociatedObjects = [];
} else {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!