You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What I would like to do is just draw a tree, and all I need for this is the id and name of the directory entries, (and probably parent_id to build the ). But I can't work out how to do get a select scope to work. Any suggestions? The query I'd expect to see would be something like:
For my use I only needed names for a test to make sure the correct hierarchy was being generated. All I personally needed was the following, so I'm providing it here in case others run into the same situation:
Tag.hash_tree.deep_transform_keys(&:to_s)
You could provide a block to deep_transform_keys if you wanted something else, however this won't help if you actually care about the SQL query generated.
With an example model DirectoryEntry, at the moment I can call
directory_entry.hash_tree
which runs the following query:What I would like to do is just draw a tree, and all I need for this is the
id
andname
of the directory entries, (and probably parent_id to build the ). But I can't work out how to do get aselect
scope to work. Any suggestions? The query I'd expect to see would be something like:Thanks
The text was updated successfully, but these errors were encountered: