From 29b077dbca96147a2887772fcf89a74d1508b638 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Thu, 5 Nov 2015 21:02:13 -0800 Subject: [PATCH] fix(model): Optimization incompatible with specs, todo --- src/flux/models/model.coffee | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/flux/models/model.coffee b/src/flux/models/model.coffee index 1f02074ad..6ff386065 100644 --- a/src/flux/models/model.coffee +++ b/src/flux/models/model.coffee @@ -68,8 +68,7 @@ class Model else values["serverId"] ?= values["id"] - @constructor.attributesKeys ?= Object.keys(@constructor.attributes) - for key in @constructor.attributesKeys + for key in Object.keys(@constructor.attributes) continue if key is 'id' continue unless values[key]? @[key] = values[key] @@ -104,8 +103,7 @@ class Model # if json["id"] and not Utils.isTempId(json["id"]) @serverId = json["id"] - @constructor.attributesKeys ?= Object.keys(@constructor.attributes) - for key in @constructor.attributesKeys + for key in Object.keys(@constructor.attributes) continue if key is 'id' attr = @constructor.attributes[key] @[key] = attr.fromJSON(json[attr.jsonKey]) unless json[attr.jsonKey] is undefined @@ -121,8 +119,7 @@ class Model # toJSON: (options = {}) -> json = {} - @constructor.attributesKeys ?= Object.keys(@constructor.attributes) - for key in @constructor.attributesKeys + for key in Object.keys(@constructor.attributes) continue if key is 'id' attr = @constructor.attributes[key] continue if attr instanceof Attributes.AttributeJoinedData and options.joined is false