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

Return `self` from `GroupChildSerializer#expand_hierarchy`

parent 9d1348d6
......@@ -6,10 +6,10 @@ class GroupChildSerializer < BaseSerializer
entity GroupChildEntity
def expand_hierarchy(hierarchy_root = nil)
tap do
@hierarchy_root = hierarchy_root
@should_expand_hierarchy = true
end
@hierarchy_root = hierarchy_root
@should_expand_hierarchy = true
self
end
def represent(resource, opts = {}, entity_class = nil)
......@@ -41,7 +41,7 @@ class GroupChildSerializer < BaseSerializer
.merge(children: Array.wrap(serializer.represent_hierarchy(children, opts)))
end
elsif hierarchy.is_a?(Array)
hierarchy.map { |child| serializer.represent_hierarchy(child, opts) }.flatten
hierarchy.flat_map { |child| serializer.represent_hierarchy(child, opts) }
else
serializer.represent(hierarchy, opts)
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