title: X is not associated to Y (Sequelize / ExpressJS)
body: <p>I am new to NodeJS with express and Sequelize. When I want to create a book rental, the console gives me &quot;Book is not associated to Rent&quot;.</p>
  <p>When I migrate the tables to the sql database, the id's are in their place and my seeders are working.</p>
  <p>Do you have the solution?</p>
  <p>Error: EagerLoadingError [SequelizeEagerLoadingError]: Book is not associated to Rent!</p>
  <p>Book model :</p>
  <pre><code>'use strict';
  const { Model } = require('sequelize');
  module.exports = (sequelize, DataTypes) =&gt; {
    class Book extends Model {
      /**
       * Helper method for defining associations.
       * This method is not a part of Sequelize lifecycle.
       * The `models/index` file will call this method automatically.
       */
      static associate(models) {
        // define association here
        this.belongsTo(models.Author);
        this.belongsTo(models.Category);
        this.hasMany(models.Rent, {
          foreignKey: 'id'
        });
      }
    }
    Book.init(
      {
        authorId: DataTypes.INTEGER,
        categoryId: DataTypes.INTEGER,
        title: DataTypes.STRING,
        description: DataTypes.TEXT,
        amount: DataTypes.INTEGER
      },
      {
        sequelize,
        modelName: 'Book'
      }
    );
    return Book;
  };
  </code></pre>
  <p>Rent model:</p>
  <pre><code>'use strict';
  const { Model } = require('sequelize');
  module.exports = (sequelize, DataTypes) =&gt; {
    class Rent extends Model {
      /**
       * Helper method for defining associations.
       * This method is not a part of Sequelize lifecycle.
       * The `models/index` file will call this method automatically.
       */
      static associate(models) {
        // define association here
        this.belongsTo(models.User);
        this.belongsTo(models.Book);
      }
    }
    Rent.init(
      {
        userId: DataTypes.INTEGER,
        bookId: DataTypes.INTEGER,
        in: DataTypes.DATE,
        back: DataTypes.DATE
      },
      {
        sequelize,
        modelName: 'Rent'
      }
    );
    return Rent;
  };
  </code></pre>
  <p>Thanks for your help guys!</p>