closure_tree
closure_tree copied to clipboard
Easily and efficiently make your ActiveRecord models support hierarchies
Introduces: - test/closure_tree/cuisine_type_test.rb - test/closure_tree/hierarchy_maintenance_test.rb - test/closure_tree/metal_test.rb
- Gem Version: 7.4.0 - Ruby: 2.4.10 - Rails: 5.0.7.2 - Database: ActiveRecord/Postgresql I am trying to make sure that dependent nodes are destroyed as the files need to be...
## Overview Recent changes introduced in v7.4.0 led to a regression in combination with paper_trail. Specifically, this change: https://github.com/ClosureTree/closure_tree/commit/f3b33f81157ccf002b8c2774b30dc35bd4722610 ``` - hierarchy_class = parent_class.const_set(short_hierarchy_class_name, Class.new(ActiveRecord::Base)) + hierarchy_class = parent_class.const_set(short_hierarchy_class_name, Class.new(model_class.superclass))...
I was not able to `rebuild!` the hierarchy in my project after upgrading from 7.3 to 7.4 and found out this is due to the changes of #384. My models...
This is helpful because we can more easily eager load ancestor_hierarchies than we can ancestors to avoid n + 1 queries. ```ruby tag = Tag.includes(:ancestor_hierarchies).first tag.depth ```
If your rails app uses multiple databases using Rails 6 convention, this allows you to specify a database for the dynamically created records
I'm using **rails 5.1.4** with **activeadmin** When try to load pages index in ActiveAdmin got the error ``` Showing /home/ap/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/activeadmin-1.2.0/app/views/active_admin/resource/index.html.arb where line #2 raised: Unknown primary key for table page_hierarchies...
Say I have a collection of categories, how would I go about eager loading all of their root categories (unless they're the root categories themselves) in one query?
Hey 👋🏼 Is there an in-build option to restructure the hierarchy table(s) in a deferred manner? E.g. When destroying a node, I don't want the hierarchy rebuild to stall returning...
I'm seeing warnings in the log when reloading a page in development after altering a model that has `closure_tree` added. ``` /Users/rbates/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/closure_tree-7.1.0/lib/closure_tree/support.rb:36: warning: already initialized constant CategoryHierarchy /Users/rbates/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/closure_tree-7.1.0/lib/closure_tree/support.rb:36: warning: previous...