From 159dfc5bc92796ca8071e312a0832194bd7033cb Mon Sep 17 00:00:00 2001 From: Muhammad Nawzad Date: Sun, 12 Nov 2023 11:29:14 +0300 Subject: [PATCH] Properly adds relationships --- lib/schemable/included_schema_generator.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/schemable/included_schema_generator.rb b/lib/schemable/included_schema_generator.rb index 7c3e02a..1f2ee4c 100644 --- a/lib/schemable/included_schema_generator.rb +++ b/lib/schemable/included_schema_generator.rb @@ -60,9 +60,8 @@ module Schemable properties: { type: { type: :string, default: model_definition.model_name }, id: { type: :string }, - attributes: attributes_schema, - relationships: relationships_schema ? {} : relationships_schema - } + attributes: attributes_schema + }.merge!(relationships_schema.blank? ? {} : { relationships: relationships_schema }) }.compact_blank end end