diff --git a/lib/relation-definition.js b/lib/relation-definition.js index b763c06e..69dc2117 100644 --- a/lib/relation-definition.js +++ b/lib/relation-definition.js @@ -1901,7 +1901,7 @@ RelationDefinition.referencesMany = function referencesMany(modelFrom, modelTo, var relationName = params.as || i8n.camelize(modelTo.pluralModelName, true); var fk = params.foreignKey || i8n.camelize(modelTo.modelName + '_ids', true); var idName = modelTo.dataSource.idName(modelTo.modelName) || 'id'; - var idType = modelTo.getPropertyType(idName); + var idType = modelTo.definition.properties[idName].type; var definition = modelFrom.relations[relationName] = new RelationDefinition({ name: relationName, diff --git a/test/relations.test.js b/test/relations.test.js index bcedc425..245b9bec 100644 --- a/test/relations.test.js +++ b/test/relations.test.js @@ -1663,7 +1663,7 @@ describe('relations', function () { cat.links.should.have.length(1); cat.items.add(product3, function(err, link) { link.should.be.instanceof(Link); - link.id.should.equal(product3.id); + link.id.should.eql(product3.id); link.name.should.equal('Product 3'); cat.links.should.have.length(2);