Skip to content

Commit 2a83d6b

Browse files
committed
Use linkage: always: true on belongs_to relationships to always include the type and id on the relationship hash
1 parent 20daafa commit 2a83d6b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/graphiti/util/serializer_relationships.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,13 @@ def block
4949
data_proc_ref = data_proc
5050
self_ref = self
5151
validate_link! if eagerly_validate_links?
52-
5352
proc do
5453
data { instance_eval(&data_proc_ref) }
5554

55+
# include relationship links for belongs_to relationships
56+
# https://github.com/graphiti-api/graphiti/issues/167
57+
linkage always: true if sideload_ref.type == :belongs_to
58+
5659
if link_ref
5760
if @proxy.query.links?
5861
self_ref.send(:validate_link!) unless self_ref.send(:eagerly_validate_links?)

0 commit comments

Comments
 (0)