Create requires an object
// FREEBIE
This commit is contained in:
parent
78d7296f84
commit
6364cda7cb
2 changed files with 4 additions and 1 deletions
|
@ -46,6 +46,9 @@
|
||||||
return conversations.get(id);
|
return conversations.get(id);
|
||||||
},
|
},
|
||||||
create: function(attrs) {
|
create: function(attrs) {
|
||||||
|
if (typeof attrs !== 'object') {
|
||||||
|
throw new Error('ConversationController.create requires an object, got', attrs);
|
||||||
|
}
|
||||||
var conversation = conversations.add(attrs);
|
var conversation = conversations.add(attrs);
|
||||||
return conversation;
|
return conversation;
|
||||||
},
|
},
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
}
|
}
|
||||||
var c = ConversationController.get(conversationId);
|
var c = ConversationController.get(conversationId);
|
||||||
if (!c) {
|
if (!c) {
|
||||||
c = ConversationController.create(conversationId);
|
c = ConversationController.create({id: conversationId});
|
||||||
c.fetch();
|
c.fetch();
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
|
|
Loading…
Reference in a new issue