title: Updating attributes in associated models using Sequelize
body: <p>Is it possible to update attributes on both the parent model and the associated models all in one go?  I am having trouble getting it to work and haven't been able to find any full examples.  I'm not sure if it's something wrong with my code or if it wasn't intended to work the way I would expect.  I tried adding the onUpdate : 'cascade' to my hasMany definition, but that didn't seem to do anything.</p>
  
  <p>Models:</p>
  
  <pre><code>module.exports = function( sequelize, DataTypes ) {
  var Filter = sequelize.define( 'Filter', {
      id : {
              type : DataTypes.INTEGER,
              autoIncrement : true,
              primaryKey : true
           },
          userId : DataTypes.INTEGER,
          filterRetweets : DataTypes.BOOLEAN,
          filterContent : DataTypes.BOOLEAN
      },
      {
          tableName : 'filter',
          timestamps : false
      }
  );
  
  var FilteredContent = sequelize.define( 'FilteredContent', {
          id : {
                  type : DataTypes.INTEGER,
                  autoIncrement : true,
                  primaryKey : true
          },
          filterId : {
                          type : DataTypes.INTEGER,
                          references : "Filter",
                          referenceKey : "id"
          },
          content : DataTypes.STRING
      },
      {
          tableName : "filteredContent",
          timestamps : false
      }
  );
  
  Filter.hasMany( FilteredContent, { onUpdate : 'cascade', as : 'filteredContent', foreignKey : 'filterId' } );
  sequelize.sync();
  
      return {
          "Filter" : Filter,
          "FilteredContent" : FilteredContent
      };
  }
  </code></pre>
  
  <p>Retrieving the filter and trying to update an attribute on the associated FilteredContent object:</p>
  
  <pre><code>Filter.find({   where: { id: 3 }, 
              include: [ { model : FilteredContent, as : 'filteredContent' } ] 
  }).success ( function( filter ) {
      var filteredContent = FilteredContent.build( {
          filterId : filter.id,
          id : 2,
          content : 'crap'
      });
      filter.save();
  });
  </code></pre>
  
  <p>This results in only attributes in the Filter object being updated.  How do I get it to also update the attributes in FilteredContent?  </p>
  
  <p>Also, is the sequelize.sync() necessary after defining my models?  I'm not clear on what exactly it is supposed to do.  I am able to retrieve my object with associations without it.  I added it to my code in desperation to get the updates working, but I'm not sure if it's actually necessary.</p>
  
  <p>Thanks</p>