I know I am just nitpicking now, but why change `inject` to `map` and `flatten`? It could be:
```ruby
children.values.inject(children.values) { |children, child| children + child.all_children }
```