forked from petejkim/factory-lady
-
Notifications
You must be signed in to change notification settings - Fork 89
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
model.build is not a function using sequelize adapter #107
Comments
The important part here is |
Sorry my bad, I thought I had posted it. Here is the content of 'use strict';
module.exports = (sequelize, DataTypes) => {
const director = sequelize.define('director', {
name: {
type: DataTypes.STRING,
allowNull: false
},
email: {
type: DataTypes.STRING,
allowNull: false
}
}, {
classMethods: {
associate: (models) => {
director.hasMany(models.school, {
foreignKey: {
allowNull: false
}
})
}
}
})
return director
} |
Okay, so const Director = require('/models/director.js')(sequelize, DataTypes); |
Thanks man ! worked like a charm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi guys !, I'm currently doing a small api on express and I'm running into an error when trying using
factory.create('director')
orfactory.build('director')
on my tests.Here is the stacktrace:
I believe it is a problem on how I'm using the library but can't figure out why. I setup the factory guiding myself through #63 (comment) but added it into an index.js file in the directory so I could export the factory to all of the rest of the files without having to repeat the process per model definition:
and my factory as follows:
any help is greatly appreciated, thanks !
The text was updated successfully, but these errors were encountered: