Save the instance even the callback is not present
This commit is contained in:
parent
b9c8018ca0
commit
af329e3a66
|
@ -1594,7 +1594,9 @@ RelationDefinition.embedsOne = function (modelFrom, modelTo, params) {
|
|||
opts.default = function() { return new modelTo(); };
|
||||
} else if (typeof params.default === 'object') {
|
||||
opts.default = (function(def) {
|
||||
return function() { return new modelTo(def); };
|
||||
return function() {
|
||||
return new modelTo(def);
|
||||
};
|
||||
}(params.default));
|
||||
}
|
||||
|
||||
|
@ -1716,11 +1718,9 @@ EmbedsOne.prototype.destroy = function (cb) {
|
|||
var modelInstance = this.modelInstance;
|
||||
var propertyName = this.definition.keyFrom;
|
||||
modelInstance.unsetAttribute(propertyName, true);
|
||||
if (typeof cb === 'function') {
|
||||
modelInstance.save(function(err) {
|
||||
cb(err);
|
||||
modelInstance.save(function (err, result) {
|
||||
cb && cb(err, result);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
RelationDefinition.embedsMany = function embedsMany(modelFrom, modelTo, params) {
|
||||
|
|
Loading…
Reference in New Issue