DAO save() now uses isNewRecord()

This commit is contained in:
Fabien Franzen 2014-09-05 17:22:14 +02:00
parent fafe51833b
commit b4144598bf
2 changed files with 2 additions and 1 deletions

View File

@ -931,7 +931,7 @@ DataAccessObject.prototype.save = function (options, callback) {
var data = inst.toObject(true);
var modelName = Model.modelName;
if (!getIdValue(Model, this)) {
if (this.isNewRecord()) {
return Model.create(this, callback);
}

View File

@ -1968,6 +1968,7 @@ EmbedsMany.prototype.prepareEmbeddedInstance = function(inst) {
var self = this;
var propertyName = this.definition.keyFrom;
var modelInstance = this.modelInstance;
inst.__persisted = true;
inst.triggerParent = function(actionName, callback) {
if (actionName === 'save' || actionName === 'destroy') {
var embeddedList = self.embeddedList();