New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction in HasManyDoubleLinked#injectAdder #1968

Closed
Softshag opened this Issue Jun 26, 2014 · 1 comment

Comments

3 participants
@Softshag

Softshag commented Jun 26, 2014

The HasManyDoubleLinked#injectAdder does not use the transaction option, when the association already exists (an update).

@mickhansen mickhansen added the Bug label Jun 26, 2014

@mickhansen mickhansen added this to the 2.0.0 release candidate milestone Jul 7, 2014

@janmeier janmeier closed this in 26aef71 Jul 13, 2014

@chr33s

This comment has been minimized.

chr33s commented Aug 7, 2014

There seems to be a bug as a result of this change, when using set with a HasManyDoubleLinked, (e.g. setExamples([1,2], { transaction: t, hooks: true }) ) it returns Error: ER_PARSE_ERROR, as a temp fix I have added a default attr check after line 87 of has has-many-double-linked.js, to filter out the options/defaultAttr and add them to to options. Is this a know bug?

if (defaultAttributes) {
  defaultAttributes = Utils._.omit(defaultAttributes, function(val, attr) {
    return Utils._.filter(['hooks', 'through', 'as', 'foreignKey', 'onDelete', 'onUpdate', 'constraints'], function(v) { // Don't try to insert options as an attribute in the through table
      options[attr] = val;
      return true;
    })
  });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment