nielsgl/sequelize-paper-trail

'document_id cannot be null' validation error occurs when using underscoredAttributes

kyledmoore opened this issue · 1 comments

This appears to be caused by the following code in lib/index.js:

      // Build revision
      var revision = Revision.build({
        model: this.name,
        documentId: instance.id,
        document: JSON.stringify(currentVersion),
        userId: ns.get(options.continuationKey) || opt[options.continuationKey]
      });

Note the hardcoded documentId property in the object passed to build, which should be document_id when underscoredAttributes is true.

Please submit a PR and I will get it fixed 👍