Commit ee2744c6 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Don't wrap arrays twice: `children` are already wrapped in an array

We do the wrapping in an array in represent_hierarchy for children.
parent e13753fc
...@@ -27,8 +27,8 @@ class GroupChildSerializer < BaseSerializer ...@@ -27,8 +27,8 @@ class GroupChildSerializer < BaseSerializer
if children.is_a?(GroupDescendant) if children.is_a?(GroupDescendant)
represent_hierarchy(children.hierarchy(hierarchy_root), opts).first represent_hierarchy(children.hierarchy(hierarchy_root), opts).first
else else
hierarchies = Array.wrap(GroupDescendant.merge_hierarchies(children, hierarchy_root)) hierarchies = GroupDescendant.merge_hierarchies(children, hierarchy_root)
hierarchies.map { |hierarchy| represent_hierarchy(hierarchy, opts) }.flatten represent_hierarchy(hierarchies, opts)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment