These are some of your many options:
Behind door 1, use reduce to accumulate the results in series.
var models = [];
[
function () {
return ModelA.create(/*...*/);
},
function () {
return ModelB.create(/*...*/);
},
function () {
return ModelC.create(/*...*/);
}
].reduce(function (ready, makeModel) {
return ready.then(function () {
return makeModel().then(function (model) {
models.push(model);
});
});
}, Q())
.catch(function (error) {
// handle errors
});
Behind door 2, pack the accumulated models into an array, and unpack with spread.
Q.try(function () {
return ModelA.create(/* params */)
})
.then(function(modelA){
return [modelA, ModelB.create(/* params */)];
})
.spread(function(modelA, modelB){
return [modelA, modelB, ModelC.create(/* params */)];
})
.spread(function(modelA, modelB, modelC){
// need to do stuff with modelA, modelB and modelC
})
.catch(/*do failure stuff*/);
Behind door 3, capture the results in the parent scope:
var models [];
ModelA.create(/* params */)
.then(function(modelA){
models.push(modelA);
return ModelB.create(/* params */);
})
.then(function(modelB){
models.push(modelB);
return ModelC.create(/* params */);
})
.then(function(modelC){
models.push(modelC);
// need to do stuff with models
})
.catch(function (error) {
// handle error
});