Skip to content

classMethods never works #473

Closed
Closed

Description

@KaltZK

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?

Activity

  1. kukukk commented on Jun 21, 2017

    @kukukk

    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.

  2. KaltZK commented on Jun 22, 2017

    @KaltZK
    Author

    @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

  3. geluso commented on Jun 23, 2017

    @geluso

    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?

  4. geluso commented on Jun 23, 2017

    @geluso

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

  5. sushantdhiman commented on Jul 23, 2017

    @sushantdhiman
    Contributor
  6. added a commit that references this issue on Jun 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions