Skip to content
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

classMethods never works #473

Closed
KaltZK opened this issue Jun 21, 2017 · 5 comments
Closed

classMethods never works #473

KaltZK opened this issue Jun 21, 2017 · 5 comments

Comments

@KaltZK
Copy link

KaltZK commented Jun 21, 2017

It seems that "associate" in the following code is never called.
It does not even exist in User.

var User = sequelize.define('User', {
    username: DataTypes.STRING,
    password: DataTypes.STRING,
    auth: {
      type: DataTypes.ENUM,
      values: ['reader', 'admin', 'root']
    }
  }, {
    classMethods: {
      associate(models){
        console.log("test")
        // pass
      }
    }
  });

In fact, all the methods defined in classMethods do not appear in User.
Is that a bug?

@kukukk
Copy link

kukukk commented Jun 21, 2017

If you check the documentation you can observe that the way of defining class level methods was modified: http://docs.sequelizejs.com/manual/tutorial/models-definition.html#expansion-of-models
But it seems to be a sequelize related problem, not sequelize-cli.

@KaltZK
Copy link
Author

KaltZK commented Jun 22, 2017

@kukukk Okay...Thanks for that...
I should have read the document more carefully...
I just found that a Pull Request had been submitted for this problem ...
#470

@geluso
Copy link

geluso commented Jun 23, 2017

The question is: will sequelize-cli be updated? What's the plan? Is there any way for us to detect which version of sequelize is being used and generate the proper code?

@geluso
Copy link

geluso commented Jun 23, 2017

The cli README could at least be updated to make it clear that it's not compatible with sequelize 4.0.0 and up.

@sushantdhiman
Copy link
Contributor

sushantdhiman commented Jul 23, 2017

codetriage-readme-bot pushed a commit to codetriage-readme-bot/cli that referenced this issue Jun 5, 2019
[nextercism] Refactor interactive stuff into its own package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants