closure_tree icon indicating copy to clipboard operation
closure_tree copied to clipboard

Easily and efficiently make your ActiveRecord models support hierarchies

Results 102 closure_tree issues
Sort by recently updated
recently updated
newest added

Hello! While testing how closure_tree is handling deep nesting for a project I noticed that at some point it started to issue an unreasonably large number of SQL queries. Looking...

Is there an easy way to get a scope of roots sorted by number of descendants? Thank you!

in the auto generated migration for adding hierarchy table, we added timestamps. but on creating a new node, it is giving a ``` irb(main):002:0> FactoryBot.create(:team, parent_team_id: 1) (0.3ms) BEGIN Team...

(or the variable is assigned nil and it's always false) While the rails maintainers decide whether it's a good idea https://github.com/rails/rails/issues/35059 I found this because out of curiosity I ran...

With an example model DirectoryEntry, at the moment I can call `directory_entry.hash_tree` which runs the following query: ```sql SELECT `directory_entries`.* FROM `directory_entries` INNER JOIN `directory_entry_hierarchies` ON `directory_entries`.`id` = `directory_entry_hierarchies`.`descendant_id` WHERE...

Not sure if this is the same issues as in #70 but eager loading the `self_and_ancestors` association in Rails 4.1 generates invalid SQL. Consider the following model: ``` class Category...

Bug
Community help requested

Is there a way how you can recreate the full hierarchy of a model with one query directly in the database? Has anyone attempted something similar? Thanks, -hendrik

At the moment the method `self_and_descendant_ids` runs a pluck on the `self_and_descendants` method. So we get SQL (for a model 'DirectoryEntry') as follows: ```sql SELECT `directory_entries`.`id` FROM `directory_entries` INNER JOIN...

eg `$ bin/rails -v` >Rails 5.1.6 `$ gem query closure_tree` > > *** LOCAL GEMS *** > > closure_tree (6.6.0) > `$ bin/rails db:migrate` > rails aborted! > StandardError: An...

Rspec is not always compatible with the latest changes in Rails. Switching to minitest should be trivial and a good exercise for someone who want to get his/her hand on...

Community help requested