Comments (4)
You'd want a named scope so you can do it in one select. Do you think this
would be generally useful to add to the library?
Matthew
On Sep 3, 2012, at 3:30 AM, Bhavin [email protected] wrote:
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.
—
Reply to this email directly or view it on
GitHubhttps://github.com//issues/17.
from closure_tree.
Scope will do however having generic method such Tag.nodes(depth)
will be cool.
I really liked this gem. I was also evaluating ltree Postgres Extension. I picked Closure Tree
because it gives a more robust and SQL compliant non-proprietary approach and has super api. I also liked the fact that unlike ltree
it retains the data integrity through foreign key association.
However, I do miss the querying ability of ltree
. Would it make sense to use some of the ltree
magic for postgres db behind the scene!!!
from closure_tree.
This feature was released in version 3.5.0 just now. Search for find_all_by_generation
in the readme.
from closure_tree.
That was really fast and very helpful :-). Thanks a lot for this beautiful gem.
from closure_tree.
Related Issues (20)
- What should I do when my data volume is very large, more than 100 million? HOT 3
- easiest way to move element within list? HOT 3
- How can I migrate 3 million data to hierarchy table?
- N + 1 feedback
- Determinstic ordering using a second column if the value of the first is null
- `parent_id` as zero HOT 1
- Postgres 12 + Rails 6.1: RETURNING "id" issue HOT 1
- Hierarchy model inheritance breaks usage with STI and superclass validations HOT 1
- Regression in combination with paper_trail gem HOT 5
- Deferred hierachy rebuild
- Self-referential model breaks `#ancestors` method. HOT 1
- Children Not Destroyed on call.
- reason for with_ancestor method using map HOT 2
- Fix compound unique index for template in hierarchies_table HOT 4
- Dirty tracking lost when setting parent with numeric_order option HOT 1
- Could there be an option for with_ancestor to include ancestors?
- Loss of namespace when using Accessing Data methods HOT 1
- SystemStackError when updating fixtures HOT 1
- parallel_test fails HOT 2
- Usage with STI table HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from closure_tree.