DAO save() now uses isNewRecord()
This commit is contained in:
parent
fafe51833b
commit
b4144598bf
|
@ -931,7 +931,7 @@ DataAccessObject.prototype.save = function (options, callback) {
|
||||||
var data = inst.toObject(true);
|
var data = inst.toObject(true);
|
||||||
var modelName = Model.modelName;
|
var modelName = Model.modelName;
|
||||||
|
|
||||||
if (!getIdValue(Model, this)) {
|
if (this.isNewRecord()) {
|
||||||
return Model.create(this, callback);
|
return Model.create(this, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1968,6 +1968,7 @@ EmbedsMany.prototype.prepareEmbeddedInstance = function(inst) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var propertyName = this.definition.keyFrom;
|
var propertyName = this.definition.keyFrom;
|
||||||
var modelInstance = this.modelInstance;
|
var modelInstance = this.modelInstance;
|
||||||
|
inst.__persisted = true;
|
||||||
inst.triggerParent = function(actionName, callback) {
|
inst.triggerParent = function(actionName, callback) {
|
||||||
if (actionName === 'save' || actionName === 'destroy') {
|
if (actionName === 'save' || actionName === 'destroy') {
|
||||||
var embeddedList = self.embeddedList();
|
var embeddedList = self.embeddedList();
|
||||||
|
|
Loading…
Reference in New Issue