Create requires an object

// FREEBIE
This commit is contained in:
lilia 2015-09-17 11:41:49 -07:00
parent 78d7296f84
commit 6364cda7cb
2 changed files with 4 additions and 1 deletions

View file

@ -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;
}, },

View file

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