From 02d51b9e4ec37a3f3902bcdecedd41a5aa1c4896 Mon Sep 17 00:00:00 2001 From: Mike Bennett Date: Wed, 2 Nov 2022 16:49:52 +0000 Subject: [PATCH] Replace related_items with [] if it doesn't exist --- app/serializers/datacite_doi_serializer.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/serializers/datacite_doi_serializer.rb b/app/serializers/datacite_doi_serializer.rb index 906d8d73e..36c897f28 100644 --- a/app/serializers/datacite_doi_serializer.rb +++ b/app/serializers/datacite_doi_serializer.rb @@ -192,7 +192,11 @@ class DataciteDoiSerializer end attribute :related_items do |object| - Array.wrap(object.related_items) + if object.related_items? + Array.wrap(object.related_items) + else + [] + end end attribute :geo_locations,