Handle id and data in sharedCtor

This commit is contained in:
Ritchie Martori 2013-06-07 18:31:29 -07:00
parent 087e3eabcb
commit ca3a3c468c
1 changed files with 5 additions and 1 deletions

View File

@ -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);