From a65cf1e4351a5994a15f66a120c6e6b2da3e161e Mon Sep 17 00:00:00 2001 From: Denis Nazarov Date: Thu, 28 Aug 2014 17:45:16 -0400 Subject: [PATCH] =?UTF-8?q?don=E2=80=99t=20override=20root=20collections?= =?UTF-8?q?=20when=20flattening=20linked?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/json_api_serializer.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/json_api_serializer.js b/src/json_api_serializer.js index 7dadd54..f1fa4c7 100644 --- a/src/json_api_serializer.js +++ b/src/json_api_serializer.js @@ -85,7 +85,12 @@ DS.JsonApiSerializer = DS.RESTSerializer.extend({ } } - payload[link] = linked[link]; + if (payload[link]){ + payload[link].pushObjects(linked[link]); + }else{ + payload[link] = linked[link]; + } + delete linked[link]; } delete payload.linked;