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

The current implementation of `hash_tree` doesn't connect the returned objects together. ``` 1 node = Node.find_by_id(1) 2 tree = node.hash_tree 3 tree.keys.first.children ``` Line 3 above will hit the database...

Feature request

I think it would be nice to have a class method `find_or_initialize_by_path(path, attributes = {})`, which behaves like ActiveRecord's `find_or_initialize_by()`. It should return a node whose name path is `path`,...

On Ruby 2.2.2 and Rails 4.0.10: Before destroying a node, I want to move its children to the root node of the tree. ``` before_destroy :move_children def move_children self.children.update_all(parent_id: self.root.id)...

Feature request
Question

I have two related models that are using closure tree to handle the hierarchy. Machines Inspections and a Machine has_many inspections. I'm trying to work out a way that given...

Question

To give an example, I have a Comment model with a score attribute (integer) that is essentially the number of votes that Comment has received. I'm doing something like this:...

Feature request

After record attribute updating ancestry_path is out-of-date. It becomes up-to-date after record reloading. ``` ruby d = Tag.find_or_create_by_path %w[a b c d] d.update {name: 'new_d'} d.ancestry_path => ["a", "b", "c",...

Feature request

I'm wondering if there is a good clean way of getting attributes from a nodes ancestors, and have it work efficiently and generically. My project has a hierarchy of organizations...

Feature request

`rails g closure_tree:migration tag` yields a migration file that contains non pluralized class name: ``` ruby class CreateTagHierarchy ``` which should be: ``` ruby class CreateTagHierarchies ``` this prevents `rake...

Bug

I have a multi-level tag hierarchy and I happened to need to know if a tag is a parent of sub-tags, but not a root. I ended up adding this...

Feature request

I use closure tree to create hierarchies for two models in my app. The first one succeeds, but the second one fails, due to the generated index name conflict ("anc_desc_idx"...