Skip to content

Commit

Permalink
updated build
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsgl committed May 2, 2016
1 parent 66d1bff commit a72e5d8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ exports.default = function (sequelize, options) {
this.addHook("afterUpdate", afterHook);

// create association
this.hasMany(sequelize.models.Revision, {
this.hasMany(sequelize.models[options.revisionModel], {
foreignKey: "document_id",
constraints: false,
scope: {
Expand Down Expand Up @@ -286,7 +286,7 @@ exports.default = function (sequelize, options) {

d.save().then(function (d) {
// Add diff to revision
revision.addRevisionChange(d);
revision['add' + options.revisionChangeModel](d);
return null;
}).catch(function (err) {
log('RevisionChange save error');
Expand Down Expand Up @@ -372,6 +372,7 @@ exports.default = function (sequelize, options) {
var RevisionChange = sequelize.define(options.revisionChangeModel, attributes, {
underscored: options.underscored
});

// Set associations
Revision.hasMany(RevisionChange, {
foreignKey: options.defaultAttributes.revisionId,
Expand Down

0 comments on commit a72e5d8

Please sign in to comment.