title: Sequelizejs is not associated to
body: <p>I made some associate but it did not work, probably with me that something is wrong, ask for help.
  There are two models</p>
  
  <pre><code>module.exports = function (sequelize, DataTypes) {
  var pages_lang = require('./pages_lang')(sequelize, DataTypes);
  return sequelize.define('pages', {
      id: {
          type: DataTypes.INTEGER(10),
          allowNull: false,
          primaryKey: true,
          autoIncrement: true,
          references :  { model: "pages_lang", key: "page_id" }
      },
      name: {
          type: DataTypes.STRING,
          allowNull: false
      },
      published: {
          type: DataTypes.BOOLEAN,
          allowNull: false,
          defaultValue: '0'
      },
      createdAt: {
          type: DataTypes.DATE,
          allowNull: false,
          defaultValue: '0000-00-00 00:00:00'
      },
      updatedAt: {
          type: DataTypes.DATE,
          allowNull: false,
          defaultValue: '0000-00-00 00:00:00'
      }
  }, {
      classMethods: {
          associate: function (models) {
              this.hasMany(models.pages_lang, {onDelete: 'SET NULL', onUpdate: 'CASCADE', foreignKey: 'page_id', as: 'pages', through: models.pages_lang});
          },
          getAll() {
              return this.findAll({include: [{model: pages_lang, as: 'pages_lang'}]}).then(function (result) {
                  return result;
              });
          }
      }
  });
  </code></pre>
  
  <p>};</p>
  
  <pre><code>module.exports = function (sequelize, DataTypes) {
  return sequelize.define('pages_lang', {
      id: {
          type: DataTypes.INTEGER(10),
          allowNull: false,
          primaryKey: true,
          autoIncrement: true
      },
      page_id: {
          type: DataTypes.INTEGER(10),
          allowNull: false,
          references :  { model: "pages", key: "id" }
      },
      content: {
          type: DataTypes.TEXT,
          allowNull: false
      }
  }, {
      classMethods: {
          associate: function (models) {
              this.belongsTo(models.pages, {foreignKey: 'id', foreignKeyConstraint:true, as: 'pages', through: models.pages});
          }
      }
  });
  </code></pre>
  
  <p>};</p>
  
  <p>But when you call results in an error</p>
  
  <blockquote>
    <p>Unhandled rejection Error: pages_lang (pages_lang) is not associated
    to pages!</p>
  </blockquote>
  
  <p>Advance very grateful for the help</p>