title: Unable to create child instance for one-to-many on Sequelize.js
body: <p>I am creating parent and child instance using sequlize, but it throws following error.</p>
  
  <pre><code>Site.hasMany(Group,{as:'groups'});
  Group.belongsTo(Site);
  
  //not working
  Site.create(siteData).then((site)=&gt;{
    site.addGroups(groupData).then(()=&gt;{  //also tried addGroup
      next();
    });
  });
  
  //this works
  Site.create(siteData).then((site)=&gt;{
   groupData.SiteId=site.id;
   Group.create(groupData).then(()=&gt;{
      next();
   });
  });
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Unhandled rejection TypeError: val.replace is not a function
        at Object.SqlString.escape (c:\APi\node_modules\sequelize\lib\sql-string.js:61:15)
        at Object.QueryGenerator.escape (c:\APi\node_modules\sequelize\lib\dialects\abstract\query-generator.js:983:22)</p>
  </blockquote>