From b7edffa0f7c601c9d812c637b9c58337ea0a5054 Mon Sep 17 00:00:00 2001 From: Richard Hallett Date: Mon, 27 May 2019 10:44:18 +0200 Subject: [PATCH] Use improved syntax for handling wrapping as array --- app/serializers/doi_serializer.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/serializers/doi_serializer.rb b/app/serializers/doi_serializer.rb index 7abbf609a..bd8771164 100644 --- a/app/serializers/doi_serializer.rb +++ b/app/serializers/doi_serializer.rb @@ -20,12 +20,8 @@ class DoiSerializer end attribute :creators do |object| - # If we're just a hash then force this over to a list. - if object.creators.class == Hash - object.creators = [object.creators] - end - - object.creators + # Always return an array of creators + Array.wrap(object.creators) end attribute :state do |object|