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

Commit 2afceddc by Jan Scheurer

Fixes has-many-dobule-linked join table attribute changes on injected setter

I'm not quite sure how the first version should've worked since the foreign
keys are afaik always prefixed with the table name which results in
mytable.mytable_id.

This commit keeps the old behavior as first try to remain backwards compatible.
1 parent 462b6ac1
Showing with 2 additions and 2 deletions
...@@ -128,8 +128,8 @@ module.exports = (function() { ...@@ -128,8 +128,8 @@ module.exports = (function() {
attributes: Utils._.defaults({}, throughAttributes, defaultAttributes) attributes: Utils._.defaults({}, throughAttributes, defaultAttributes)
} }
changedAssociation.where[self.association.identifier] = self.instance[self.association.identifier] || self.instance.id changedAssociation.where[self.association.identifier] = self.instance[self.association.identifier] || self.instance[self.association.source.primaryKeyAttributes[0]] || self.instance.id
changedAssociation.where[foreignIdentifier] = newObj[foreignIdentifier] || newObj.id changedAssociation.where[foreignIdentifier] = newObj[foreignIdentifier] || newObj[self.association.target.primaryKeyAttributes[0]] || newObj.id
if (Object.keys(changedAssociation.attributes).length) { if (Object.keys(changedAssociation.attributes).length) {
changedAssociations.push(changedAssociation) changedAssociations.push(changedAssociation)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!