Update with association using Sequelize.js
<p>I am trying to update with association using sequelize.js.</p>

<p>I have tried give example on stackoverflow namely the following links:</p>

<p><a href="https://stackoverflow.com/questions/33918383/sequelize-update-with-association">Sequelize update with association</a>
<a href="https://stackoverflow.com/questions/33918383/sequelize-update-with-association">Sequelize update with association</a>
<a href="https://stackoverflow.com/questions/22586712/updating-attributes-in-associated-models-using-sequelize">Updating attributes in associated models using Sequelize</a></p>

<p>all of these links did not get me to the goal i am trying to accomplish.
My model is as follow, I have a country module and a city module. a country has many cities. please refer to the module bellow. 
Please advise. </p>

<p><strong>country.js file</strong></p>

<pre><code>module.exports = function (sequelize, DataTypes) {
    var country= sequelize.define('COUNTRY', {
        COUNTRY_ID: {
            type: DataTypes.INTEGER,
            primaryKey: true,
            autoIncrement: true

        },
        COUNTRY_NAME: DataTypes.STRING,
        COUNTRY_CURRENCY: DataTypes.STRING

    }, {
        freezeTableName: true,
        classMethods: {
            associate: function (models) {

                COUNTRY_ID.hasMany(models.CITIES, {

                    foreignKey: 'COUNTRY_ID'
                })


            }
        },
         instanceMethods: {
            updateAssociation: function (onSuccess, onError) {
                country.findAll({

                        where: {
                             COUNTRY_ID: req.params.country_id
                     },
                       include: [
                          {
                              model: sequelize.import('./cities.js'), 
                          }
                        ]

                    })

                    })
                    .then(country =&gt;{
                    const updatePromises = country.map(countries =&gt;{
                        return countries.updateAttributes(req.body);
                    });
                    const updatePromisescities = list.CITY.map(cities =&gt;{
                    return cities.updateAttributes(req.body.CITYs[0]);

                   });
                    return sequelize.Promise.all([updatePromises, updatePromisescities ])
                  }).then(onSuccess).error(onError);           
                }

        }
    });
    return country;
};
</code></pre>

<p><strong>city.js file</strong></p>

<pre><code>module.exports = function (sequelize, DataTypes) {
    var CITY = sequelize.define('LIST_CODE', {
        CITY_ID: {
            type: DataTypes.INTEGER,
            primaryKey: true
        },
        COUNTRY_ID: {
            type: DataTypes.INTEGER,
            primaryKey: true
        }
    }, {
        freezeTableName: true,
        timestamps: false,
        classMethods: {
            associate: function (models) {
                // associations can be defined here

                CITY.belongsTo(models.COUNTRY, {

                    foreignKey: 'COUNTRY_ID'
                })
            }
        }

});
    return CITY;
};
</code></pre>