Check the existence of id
This commit is contained in:
parent
6f111f8122
commit
0866f33cec
|
@ -91,7 +91,8 @@ Memory.prototype.create = function create(model, data, callback) {
|
||||||
this.ids[model] = Number(currentId) + 1;
|
this.ids[model] = Number(currentId) + 1;
|
||||||
|
|
||||||
var props = this._models[model].properties;
|
var props = this._models[model].properties;
|
||||||
id = props[this.idName(model)].type(id);
|
var idName = this.idName(model);
|
||||||
|
id = (props[idName] && props[idName].type && props[idName].type(id)) || id;
|
||||||
this.setIdValue(model, data, id);
|
this.setIdValue(model, data, id);
|
||||||
this.cache[model][id] = JSON.stringify(data);
|
this.cache[model][id] = JSON.stringify(data);
|
||||||
process.nextTick(function() {
|
process.nextTick(function() {
|
||||||
|
|
Loading…
Reference in New Issue