From 4d79159973d7b51230ceb9efd33bb1cbb191621b Mon Sep 17 00:00:00 2001 From: Bob Van Landuyt Date: Fri, 13 Oct 2017 15:13:52 +0200 Subject: Make sure we always return an array of hierarchies Even when we pass an array of only a single object --- app/serializers/group_child_serializer.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'app/serializers') diff --git a/app/serializers/group_child_serializer.rb b/app/serializers/group_child_serializer.rb index 6d0e67a37cd..2baef0a5703 100644 --- a/app/serializers/group_child_serializer.rb +++ b/app/serializers/group_child_serializer.rb @@ -28,7 +28,9 @@ class GroupChildSerializer < BaseSerializer represent_hierarchy(children.hierarchy(hierarchy_root), opts).first else hierarchies = GroupDescendant.build_hierarchy(children, hierarchy_root) - represent_hierarchy(hierarchies, opts) + # When an array was passed, we always want to represent an array. + # Even if the hierarchy only contains one element + represent_hierarchy(Array.wrap(hierarchies), opts) end end -- cgit v1.2.3