Skip to content

hash_tree doesn't eager load children #155

Open
@villesundberg

Description

@villesundberg

The current implementation of hash_tree doesn't connect the returned objects together.

1 node = Node.find_by_id(1)
2 tree = node.hash_tree
3 tree.keys.first.children

Line 3 above will hit the database again, even though the children of node 1 have already been retrieved. It would be reasonable to expect line 2 to construct the tree so that calls to children or parent don't hit the database.

Is this by design, or would this be a desirable improvement?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions