From bfb2e155b422e519372d0a40edcfea792add471c Mon Sep 17 00:00:00 2001 From: Markus Grigull Date: Tue, 6 Oct 2015 21:43:07 +0200 Subject: [PATCH] Fix receiving entities with no attributes --- app/models/entity.js | 2 -- app/serializers/application.js | 20 +++++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/models/entity.js b/app/models/entity.js index e6af0b6..885c899 100644 --- a/app/models/entity.js +++ b/app/models/entity.js @@ -8,8 +8,6 @@ export default DS.Model.extend({ poll: function() { var _this = this; Ember.run.later( function() { - Ember.debug("reload"); - _this.reload(); _this.poll(); }, 1000); diff --git a/app/serializers/application.js b/app/serializers/application.js index c71ef80..e388765 100644 --- a/app/serializers/application.js +++ b/app/serializers/application.js @@ -39,16 +39,18 @@ export default DS.RESTSerializer.extend({ } } - item.contextElement.attributes.forEach(function(attribute) { - var property = { - name: attribute.name, - value: attribute.value, - type: attribute.type, - timestamp: attribute.metadatas[0].value - } + if (item.contextElement.attributes) { + item.contextElement.attributes.forEach(function(attribute) { + var property = { + name: attribute.name, + value: attribute.value, + type: attribute.type, + timestamp: attribute.metadatas[0].value + } - entity.attributes.properties.push(property); - }); + entity.attributes.properties.push(property); + }); + } // pass entity to caller function if (handleEntity(entity) == false) {