From 77028b07f87ae4626acfcffa7de5acd9061c1f94 Mon Sep 17 00:00:00 2001 From: Fabien Franzen Date: Mon, 24 Nov 2014 10:31:28 +0100 Subject: [PATCH] Be explicit: set RelationDefinition multiple flag --- lib/relation-definition.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/relation-definition.js b/lib/relation-definition.js index 38f5552c..e3e369fe 100644 --- a/lib/relation-definition.js +++ b/lib/relation-definition.js @@ -114,7 +114,7 @@ function RelationDefinition(definition) { } this.modelThrough = definition.modelThrough; this.keyThrough = definition.keyThrough; - this.multiple = (this.type !== 'belongsTo' && this.type !== 'hasOne'); + this.multiple = definition.multiple; this.properties = definition.properties || {}; this.options = definition.options || {}; this.scope = definition.scope; @@ -1139,6 +1139,7 @@ RelationDefinition.belongsTo = function (modelFrom, modelTo, params) { keyFrom: fk, keyTo: idName, modelTo: modelTo, + multiple: false, properties: params.properties, scope: params.scope, options: params.options, @@ -1447,6 +1448,7 @@ RelationDefinition.hasOne = function (modelFrom, modelTo, params) { keyFrom: pk, keyTo: fk, modelTo: modelTo, + multiple: false, properties: params.properties, scope: params.scope, options: params.options,