From 6364cda7cb62bf7a7639ce47517165a9627f6cbc Mon Sep 17 00:00:00 2001 From: lilia Date: Thu, 17 Sep 2015 11:41:49 -0700 Subject: [PATCH] Create requires an object // FREEBIE --- js/conversation_controller.js | 3 +++ js/models/messages.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/js/conversation_controller.js b/js/conversation_controller.js index 8aa817c6169..a35f36645d2 100644 --- a/js/conversation_controller.js +++ b/js/conversation_controller.js @@ -46,6 +46,9 @@ return conversations.get(id); }, create: function(attrs) { + if (typeof attrs !== 'object') { + throw new Error('ConversationController.create requires an object, got', attrs); + } var conversation = conversations.add(attrs); return conversation; }, diff --git a/js/models/messages.js b/js/models/messages.js index b0cfbad95f4..806f9d3e3d2 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -103,7 +103,7 @@ } var c = ConversationController.get(conversationId); if (!c) { - c = ConversationController.create(conversationId); + c = ConversationController.create({id: conversationId}); c.fetch(); } return c;