title: Sequelize associations hasOne, belongsTo
body: <p>The problem is that I can not get working the relation hasOne, which does not eager load the state type object.</p>
  
  <p>All the queries are done on existing tables.</p>
  
  <p>Here is the customer table, whats important is the <code>cst_state_type</code> field:</p>
  
  <pre><code>module.exports = function(sequelize, DataTypes) {
  
      return sequelize.define('customer', {
  
          customer: {
              type: DataTypes.INTEGER,
              primaryKey: true,
              autoIncrement: true,
              allowNull: true,
              validate: {
                  isNumeric: true
              }
          },
          first_name: {
              type: DataTypes.STRING(100),
              validate: {
                  isAlphanumeric: true
              }
          },
          last_name: DataTypes.STRING(100),
          identity_code: {
              type: DataTypes.STRING(20),
              allowNull: true,
              validate: {
                  isNumeric: true
              }
          },
          note: DataTypes.STRING(1000),
          birth_date: DataTypes.DATE,
  
  
          created_by: DataTypes.INTEGER,
          updated_by: DataTypes.INTEGER,
  
          cst_type: DataTypes.INTEGER,
          cst_state_type:  {
              type: DataTypes.INTEGER,
          }
  
      }, {
          tableName: 'customer',
  
          updatedAt: 'updated',
          createdAt: 'created',
          timestamps: true
      });
  };
  </code></pre>
  
  <p>cst_state_type table:</p>
  
  <pre><code>module.exports = function(sequelize, DataTypes) {
  
      return sequelize.define('StateType', {
  
          cst_state_type: {
              type: DataTypes.INTEGER,
              primaryKey: true,
              autoIncrement: true,
              validate: {
              }
          },
          name: DataTypes.STRING(100),
      }, {
          tableName: 'cst_state_type',
          timestamps: false
      });
  };
  </code></pre>
  
  <p>How the relations are described: </p>
  
  <pre><code>  global.db.Customer.hasOne(global.db.StateType, {
      foreignKey: 'cst_state_type',
      as: 'state_type'
    });
  
    global.db.StateType.belongsTo(global.db.Customer, {
      foreignKey: 'cst_state_type'
    });
  </code></pre>
  
  <p>And creating eager loading query: </p>
  
  <pre><code>    db.Customer.findAll( {
          include: [
              { model: db.Address, as: 'addresses' },
              { model: db.StateType, as: 'state_type' }
          ]
      })
          .success(function (customers) {
              res.json(200, customers);
          })
          .fail(function (error) {
              res.json(500, { msg: error });
          });
  </code></pre>