From ca3a3c468cee6172d0904682aa6bcb69d2b243ea Mon Sep 17 00:00:00 2001 From: Ritchie Martori Date: Fri, 7 Jun 2013 18:31:29 -0700 Subject: [PATCH] Handle id and data in sharedCtor --- lib/application.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/application.js b/lib/application.js index 563f6449..b89ff319 100644 --- a/lib/application.js +++ b/lib/application.js @@ -124,7 +124,11 @@ app.define = function (name, properties, options) { id = null; } - if(data) { + if(id && data) { + var model = new ModelCtor(data); + model.id = id; + fn(null, model); + } else if(data) { fn(null, new ModelCtor(data)); } else if(id) { ModelCtor.find(id, fn);