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

Commit 510ff542 by Sushant

refactor(belongs-to-many): remove old code for filtering options.through

This code was used to prevent passing transaction, fields, logging like
options to "create / update" call of junction table. This is no longer
required as we pass junction table data in a different object options.through
now.
1 parent cd21f7ed
Showing with 2 additions and 5 deletions
......@@ -533,10 +533,7 @@ class BelongsToMany extends Association {
const updateAssociations = currentRows => {
const obsoleteAssociations = [];
const promises = [];
let defaultAttributes = options.through || {};
// Don't try to insert the transaction as an attribute in the through table
defaultAttributes = _.omit(defaultAttributes, ['transaction', 'hooks', 'individualHooks', 'ignoreDuplicates', 'validate', 'fields', 'logging']);
const defaultAttributes = options.through || {};
const unassociatedObjects = newAssociatedObjects.filter(obj =>
!_.find(currentRows, currentRow => currentRow[foreignIdentifier] === obj.get(targetKey))
......@@ -626,7 +623,7 @@ class BelongsToMany extends Association {
const targetKey = association.target.primaryKeyAttribute;
const identifier = association.identifier;
const foreignIdentifier = association.foreignIdentifier;
const defaultAttributes = _.omit(options.through || {}, ['transaction', 'hooks', 'individualHooks', 'ignoreDuplicates', 'validate', 'fields', 'logging']);
const defaultAttributes = options.through || {};
newInstances = association.toInstanceArray(newInstances);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!