Check the existence of id

This commit is contained in:
Raymond Feng 2013-08-28 21:39:59 -07:00
parent 6f111f8122
commit 0866f33cec
1 changed files with 2 additions and 1 deletions

View File

@ -91,7 +91,8 @@ Memory.prototype.create = function create(model, data, callback) {
this.ids[model] = Number(currentId) + 1;
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.cache[model][id] = JSON.stringify(data);
process.nextTick(function() {