title: Sequelize findAll with association and foreign key
body: <p>I'm using sequelize to model a mySql-database schema in my node-application. Let's say I have 3 table: Project, User and Role.</p>
  
  <p>It's a "Many to Many" association between Project and User through "Project_User" where is defined the role of a user for a project.</p>
  
  <p><strong>Project Model :</strong></p>
  
  <pre><code>var Project = sequelize.define('Project', {
      name:{type: DataTypes.STRING, unique: true}
  },
  classMethods: {
     associate: function(models) {
         Project.belongsToMany(models.User, { through: 'Project_User', as: 'users'});
     }
  }
  // Methods...
  );
  </code></pre>
  
  <p><strong>User Model :</strong></p>
  
  <pre><code>var User= sequelize.define('User', {
      name:{type: DataTypes.STRING, unique: true}
  },
  classMethods: {
     associate: function(models) {
         User.belongsToMany(models.Project, { through: 'Project_User', as: 'projects'});
     }
  }
  // Methods...
  );
  </code></pre>
  
  <p>And here is the association table <strong>Project_User Model</strong> :</p>
  
  <pre><code>var Project_User = sequelize.define('Project_User', {
      role:
      {
          type: DataTypes.INTEGER,
          allowNull: false,
          references: 'Role',
          referencesKey: 'id'
      }
  },{
      classMethods: {
          associate: function(models) {
              Project_User.belongsTo(models.Role, {foreignKey: 'role'});
          }
      }
  });
  </code></pre>
  
  <p>Now, I want to find all project, with their users and their role. So I've used findAll with the "include" parameters like below:</p>
  
  <pre><code>models.Projects.findAll({
      include:[
               {
                   model: models.User, 
                   as:'users',
                   through: {attributes: ['role'], as: 'role'}
               }]
  }).then(function(result) {
       // ...
  });
  </code></pre>
  
  <p>This works great but I only have the roleId associated to the user. I wasn't be able to link this "roleId" with the role table to get the other attributes like role name...</p>
  
  <p>Here is the JSON I've got :</p>
  
  <pre><code>[
  {
      "id": 1,
      "name": "Project name",
      "users": [
          {
              "id": 1,
              "name": "User name",
              "role": {
                  "role": 1
              }
          }
      ]
  }
  ]
  </code></pre>
  
  <p>But I would like to have something like that : </p>
  
  <pre><code>[
  {
      "id": 1,
      "name": "Project name",
      "users": [
          {
              "id": 1,
              "name": "User name",
              "role": {
                  "id": 1,
                  "name": "Role name",
                  "description": "Some info...",
              }
          }
      ]
  }
  ]
  </code></pre>
  
  <p>I've tried many things to realize this association, even successive includes but it was unsuccessful. What is needed in the findAll options to get this JSON result ?</p>
  
  <p>Thanks</p>