From 0866f33cec3131f9b4ece50648419f423f92aa96 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Wed, 28 Aug 2013 21:39:59 -0700 Subject: [PATCH] Check the existence of id --- lib/connectors/memory.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/connectors/memory.js b/lib/connectors/memory.js index 5a155e5f..2749c040 100644 --- a/lib/connectors/memory.js +++ b/lib/connectors/memory.js @@ -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() {