Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Matthew McEachen
    @mceachen
    Just set up Gitter for ClosureTree, hope it can be helpful!
    James McCarthy
    @james2m
    I’m just experimenting with moving from awesome_nested_set to closure_tree. The model had acts_as_nested_set order_column: :position, with position as an integer but not enforced.
    I want to keep the same behaviour in closure_tree. i.e. I want the children sorted by position but don’t want that column updated by closure_tree, only sorted.
    Any way to achieve this? Seems to be all or nothing, but I can see ClosureTree::SupportFlags.order_is_numeric? would give me what I want, but how to override it?
    James McCarthy
    @james2m
    let’s try the existing code snippet again :)
    acts_as_nested_set order_column: :position
    Matthew McEachen
    @mceachen
    Numeric sort order powers a lot of functionality that's pretty hairy, like the roots_and_descendants_preordered, so I didn't leave that as an exercise to the reader
    a couple selects assume no gaps in indexes, for example
    @james2m ^^
    but I assumed it should be an all-or-nothing affair--either you care about order, and let closure tree maintain it, or those numbers mean something specific, which means you should have another order_by criteria that you own and operate.
    James McCarthy
    @james2m
    @mceachen Thanks. I cheekily kept
    has_closure_tree order: ‘position'
    but forced #order_is_numeric? to false to drop all the hairy stuff. I’m only using a very minor subset self_and_descendants / ancestors but need them to perform well.
    Matthew McEachen
    @mceachen
    @james2m sgtm. If you think of a nice way for the API to expose that, I'm all ears (and happy to merge PRs with test coverage, too!)
    James McCarthy
    @james2m
    @mceachen I’d say it belongs in the options for has_closure_tree. But what to call it?
    has_closure_tree order: ‘position’, numeric_ordering: false
    Matthew McEachen
    @mceachen
    sgtm! Do you want to try making a pull request?
    James McCarthy
    @james2m
    Yes, will do.
    Matthew McEachen
    @mceachen
    Excellent, ping me here if you have questions
    James McCarthy
    @james2m
    Cool. Will do. Thanks for an excellent gem.
    Matthew McEachen
    @mceachen
    Looks like nokogiri dropped support for ruby 2.0.x, which caused mceachen/closure_tree#250 to fail CI. Would anyone be sad to drop ruby 2.0 from the build matrix
    Kiril Dokh
    @dsounded
    Hello, guys
    have a trouble
    after updating from Rails 4.2.5 to Rails 5..0.1 got deadlock

    SELECT GET_LOCK('13f4ebad71bf21124eb4ea01bab767c17', 0) AS tc4694821d4ce609e0c9ab5203b847cbd

    and can’t do anything after that

    I have nested_attributes_for and after that I am saving parent items(parent items has nested_attributes_for their childs also)
    If I comment out has_closure_tree DSL, it works, but with it I have deadlocks
    @mceachen could you please help ?
    Kiril Dokh
    @dsounded

    mceachen/closure_tree#240

    seems ike this problem

    Kiril Dokh
    @dsounded
    I described my case there
    Matthew McEachen
    @mceachen
    @/all please review mceachen/closure_tree#277 and add your comment and vote. Thanks!
    Warren H. Prince
    @UnConundrum
    Are there any tools or how_tos to migrate from Ancestry to ClosureTree ?
    Bobby Uhlenbrock
    @uhlenbrock
    @UnConundrum The installation has steps to make the transition. https://github.com/ClosureTree/closure_tree#installation
    Warren H. Prince
    @UnConundrum
    Yes, saw that and have added the parent_id column. I inferred from the instructions that a populated parent_id column was needed to run rebuild!. Will rebuild! work off of the ancestry column?
    Warren H. Prince
    @UnConundrum
    Just checked it and yes, it does seem to be migrating for me. Thx.
    Alex Ziegler
    @Ayyzee

    Hi all;

    I have a rails application that makes a connection to a different database. The
    basic setup is something like:

    # Bar Service
    class Category
       establish_connection(:foo_service)
       has_closure_tree order: "name"
    end

    Fetching records in Bar Service works fine-- I can walk the tree via the relational
    hierarchy. However, when I try to create an object it fails with:
    ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "category_hierarchies" does not exist

    I can see that category_hierarchies is not an available table in bar service
    (as we haven't run the migrations there, and are hoping not to do so). Does
    anyone here know of a clean way to connect the closure tree to a separate db--?

    Tim Wisniewski
    @timwis
    Hi all 👋 I’d like to leverage recursive window queries (aka common table expressions, a modern feature of Postgres and MySQL) for my nesting/ancestry, to optimise query performance. Has anyone heard of a way to do that in rails?