-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimized query for filtering nodes with a given depth #17
Comments
You'd want a named scope so you can do it in one select. Do you think this Matthew On Sep 3, 2012, at 3:30 AM, Bhavin notifications@github.com wrote: What is the best way to get all the nodes with a given depth. Currently, I — |
Scope will do however having generic method such I really liked this gem. I was also evaluating ltree Postgres Extension. I picked However, I do miss the querying ability of |
This feature was released in version 3.5.0 just now. Search for |
That was really fast and very helpful :-). Thanks a lot for this beautiful gem. |
What is the best way to get all the nodes with a given depth. Currently, I do
Node.all.select {|n| n.depth == 3}
. This generates one query for each iteration which isn't very optimized.The text was updated successfully, but these errors were encountered: