Git Product home page Git Product logo

Comments (4)

mceachen avatar mceachen commented on August 26, 2024

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.

bhavinkamani avatar bhavinkamani commented on August 26, 2024

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.

mceachen avatar mceachen commented on August 26, 2024

This feature was released in version 3.5.0 just now. Search for find_all_by_generation in the readme.

from closure_tree.

bhavinkamani avatar bhavinkamani commented on August 26, 2024

That was really fast and very helpful :-). Thanks a lot for this beautiful gem.

from closure_tree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.