Skip to content

Commit d3140d9

Browse files
authored
Merge pull request #240 from digitalsadhu/belongsTo-empty-response
null response for empty BelongsTo relationship
2 parents 85323a4 + 483430f commit d3140d9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/serializer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ function parseRelations (data, relations, options) {
269269
// No `data` key should be present unless there is actual relationship data.
270270
if (relationship) {
271271
relationships[name].data = relationship
272+
} else if (relation.type === 'belongsTo') {
273+
relationships[name].data = null
272274
}
273275
})
274276

0 commit comments

Comments
 (0)