From ebd9ecd1fd5cc9c09fa10bb7a7bea15cbab54381 Mon Sep 17 00:00:00 2001 From: Steve Geluso Date: Fri, 16 Jun 2017 04:40:13 -0700 Subject: [PATCH 1/3] moving model.associate outside classMethods due to sequelize@4.0.0 --- lib/assets/models/model.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/assets/models/model.js b/lib/assets/models/model.js index a9b4eee1..c3800e80 100644 --- a/lib/assets/models/model.js +++ b/lib/assets/models/model.js @@ -8,12 +8,11 @@ module.exports = function(sequelize, DataTypes) { <% }) %> }, { <%= underscored ? 'underscored: true,' : '' %> - classMethods: { - associate: function(models) { - // associations can be defined here - } - } }); + <%= name %>.associate = function(models) { + // associations can be defined here + }; + return <%= name %>; }; From 789e463dfe0117aa6846c61a4c32c3835957e60e Mon Sep 17 00:00:00 2001 From: Steve Geluso Date: Fri, 16 Jun 2017 07:07:33 -0700 Subject: [PATCH 2/3] removing classMethod from test expectation --- test/model/create.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/model/create.test.js b/test/model/create.test.js index 5f640b5f..afdec2a5 100644 --- a/test/model/create.test.js +++ b/test/model/create.test.js @@ -194,7 +194,7 @@ var _ = require('lodash'); var targetContent = attrUnd.underscored ? 'underscored: true' - : '{\n classMethods'; + : '{});'; if ( attrUnd.underscored ) { flags.underscored = attrUnd.underscored; From ba94a1c5290bdd24408eda471959e20f3e6cd6e7 Mon Sep 17 00:00:00 2001 From: "Buddy Lindsey, Jr" Date: Wed, 14 Feb 2018 07:42:23 -0600 Subject: [PATCH 3/3] Add assertion for `.associate` --- test/model/create.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/model/create.test.js b/test/model/create.test.js index 91939d0f..98bf19fd 100644 --- a/test/model/create.test.js +++ b/test/model/create.test.js @@ -210,6 +210,7 @@ const _ = require('lodash'); .src(Support.resolveSupportPath('tmp', 'models')) .pipe(helpers.readFile('user.js')) .pipe(helpers.ensureContent(targetContent)) + .pipe(helpers.ensureContent('.associate')) .pipe(helpers.teardown(done)); }); });