website icon indicating copy to clipboard operation
website copied to clipboard

addProfile is not function on many to many relationship

Open s1nistr4 opened this issue 2 years ago • 1 comments

Bug Description

I am copying and pasting the following from here to set up a one to many relationship, it says .addProfile is not a function, after copying and pasting the code with the table definitions already set up in the readme. This also goes if I switch the name "Profile" to the child element, such as addCart or addTag, etc.

When you compile the code, it says ".addProfile" is not a function. I'm assuming sequelize dynamically creates this method but that doesn't seem to happen

What do you expect to happen?

For it to not give an error

What is actually happening?

Gives an error

s1nistr4 avatar Jan 06 '24 22:01 s1nistr4

You can check what methods are available on your model by calling console.dir(User.prototype) after having called User.belongsToMany(Profile)

ephys avatar Feb 02 '24 21:02 ephys