title: SequelizeJS Cannot read property 'getTableName' of undefined
body: <p>I am running into an issue where I am trying to associate two models that have a one-to-many relationship. For some reason this query is throwing an error despite referencing the relationship.</p>
  
  <p>Here is my error message:</p>
  
  <pre><code>Unhandled rejection TypeError: Cannot read property 'getTableName' of undefined
      at generateJoinQueries (/Users/user/Desktop/Projects/node/project/node_modules/sequelize/lib/dialects/abstract/query-generator.js:1181:43)
  </code></pre>
  
  <p>This is the route:</p>
  
  <pre><code>appRoutes.route('/settings')
  
      .get(function(req, res, organization){
          models.DiscoverySource.findAll({
              where: { 
                  organizationId: req.user.organizationId
              },
              include: [{
                  model: models.Organization, through: { attributes: ['organizationName', 'admin', 'discoverySource']}
              }]
          }).then(function(organization, discoverySource){
              res.render('pages/app/settings.hbs',{
                  organization: organization,
                  discoverySource: discoverySource
              });
          })
  
      });
  </code></pre>
  
  <p>DiscoverySource:</p>
  
  <pre><code>module.exports = function(sequelize, DataTypes) {
  
  var DiscoverySource = sequelize.define('discovery_source', {
      discoverySourceId: {
          type: DataTypes.INTEGER,
          field: 'discovery_source_id',
          autoIncrement: true,
          primaryKey: true
      },
      discoverySource: {
          type: DataTypes.STRING,
          field: 'discovery_source_name'
      },
      organizationId: {
          type: DataTypes.TEXT,
          field: 'organization_id'
      },
  },{
      freezeTableName: true,
      classMethods: {
          associate: function(db) {
              DiscoverySource.belongsTo(db.Organization, {foreignKey: 'organization_id'});
          },
      },
  });
      return DiscoverySource;
  }
  </code></pre>
  
  <p>Organization:</p>
  
  <pre><code>module.exports = function(sequelize, DataTypes) {
  
  var Organization = sequelize.define('organization', {
      organizationId: {
          type: DataTypes.INTEGER,
          field: 'organization_id',
          autoIncrement: true,
          primaryKey: true
      },
      organizationName: {
          type: DataTypes.STRING,
          field: 'organization_name'
      },
      admin: DataTypes.STRING
  },{
      freezeTableName: true,
      classMethods: {
          associate: function(db) {
              Organization.hasMany(db.DiscoverySource, {foreignKey: 'organization_id'});
          },
      }
  });
      return Organization;
  }
  </code></pre>