From a0dc6612d840729d90f9f891cd8bc0fd1c508bdd Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Tue, 28 Apr 2015 16:02:36 -0700 Subject: [PATCH] fix(attribute-joined-data): Critical fix for NULL joined data values --- src/flux/attributes/attribute-joined-data.coffee | 3 ++- src/flux/models/query.coffee | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/flux/attributes/attribute-joined-data.coffee b/src/flux/attributes/attribute-joined-data.coffee index 446201a94..02882e4bb 100644 --- a/src/flux/attributes/attribute-joined-data.coffee +++ b/src/flux/attributes/attribute-joined-data.coffee @@ -44,5 +44,6 @@ class AttributeJoinedData extends Attribute includeSQL: (klass) -> "LEFT OUTER JOIN `#{@modelTable}` ON `#{@modelTable}`.`id` = `#{klass.name}`.`id`" + NullPlaceholder: NullPlaceholder -module.exports = AttributeJoinedData \ No newline at end of file +module.exports = AttributeJoinedData diff --git a/src/flux/models/query.coffee b/src/flux/models/query.coffee index 808a69194..c700c2849 100644 --- a/src/flux/models/query.coffee +++ b/src/flux/models/query.coffee @@ -1,4 +1,4 @@ -{Matcher, NullPlaceholder, AttributeJoinedData} = require '../attributes' +{Matcher, AttributeJoinedData} = require '../attributes' _ = require 'underscore-plus' ### @@ -179,7 +179,7 @@ class ModelQuery object = (new @_klass).fromJSON(json) for attr, j in @_includeJoinedData value = row[j+1] - value = null if value is NullPlaceholder + value = null if value is AttributeJoinedData.NullPlaceholder object[attr.modelKey] = value objects.push(object) return objects[0] if @_singular