README.md in closure_tree-6.5.0 vs README.md in closure_tree-6.6.0
- old
+ new
@@ -1,17 +1,18 @@
# Closure Tree
+__Important: please [vote on the future of ClosureTree](https://github.com/ClosureTree/closure_tree/issues/277)!__
+
### Closure_tree lets your ActiveRecord models act as nodes in a [tree data structure](http://en.wikipedia.org/wiki/Tree_%28data_structure%29)
Common applications include modeling hierarchical data, like tags, threaded comments, page graphs in CMSes,
and tracking user referrals.
[![Join the chat at https://gitter.im/closure_tree/Lobby](https://badges.gitter.im/closure_tree/Lobby.svg)](https://gitter.im/closure_tree/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-[![Build Status](https://api.travis-ci.org/mceachen/closure_tree.svg?branch=master)](http://travis-ci.org/mceachen/closure_tree)
+[![Build Status](https://api.travis-ci.org/ClosureTree/closure_tree.svg?branch=master)](http://travis-ci.org/ClosureTree/closure_tree)
[![Gem Version](https://badge.fury.io/rb/closure_tree.svg)](https://badge.fury.io/rb/closure_tree)
-[![Codacy Badge](https://api.codacy.com/project/badge/Grade/fa5a8ae2193d42adb30b4256732a757d)](https://www.codacy.com/app/matthew-github/closure_tree)
-[![Dependency Status](https://gemnasium.com/badges/github.com/mceachen/closure_tree.svg)](https://gemnasium.com/github.com/mceachen/closure_tree)
+[![Dependency Status](https://gemnasium.com/badges/github.com/ClosureTree/closure_tree.svg)](https://gemnasium.com/github.com/ClosureTree/closure_tree)
Dramatically more performant than
[ancestry](https://github.com/stefankroes/ancestry) and
[acts_as_tree](https://github.com/amerine/acts_as_tree), and even more
awesome than [awesome_nested_set](https://github.com/collectiveidea/awesome_nested_set/),
@@ -24,13 +25,12 @@
* Fetch all [descendants as a nested hash](#nested-hashes) in 1 SELECT.
* [Find a node by ancestry path](#find_or_create_by_path) in 1 SELECT.
* __Best-in-class mutation performance__:
* 2 SQL INSERTs on node creation
* 3 SQL INSERT/UPDATEs on node reparenting
-* __Support for [concurrency](#concurrency)__ (using [with_advisory_lock](https://github.com/mceachen/with_advisory_lock))
-* __Support for ActiveRecord 4.2 and 5.0__
-* __Support for Ruby 2.2 and 2.3__
+* __Support for [concurrency](#concurrency)__ (using [with_advisory_lock](https://github.com/ClosureTree/with_advisory_lock))
+* __Tested against ActiveRecord 4.2, 5.0, and 5.1, with Ruby 2.2 and 2.3__
* Support for reparenting children (and all their descendants)
* Support for [single-table inheritance (STI)](#sti) within the hierarchy
* ```find_or_create_by_path``` for [building out heterogeneous hierarchies quickly and conveniently](#find_or_create_by_path)
* Support for [deterministic ordering](#deterministic-ordering)
* Support for [preordered](http://en.wikipedia.org/wiki/Tree_traversal#Pre-order) traversal of descendants
@@ -252,11 +252,11 @@
**If your tree is large (or might become so), use :limit_depth.**
Without this option, ```hash_tree``` will load the entire contents of that table into RAM. Your
server may not be happy trying to do this.
-HT: [ancestry](https://github.com/stefankroes/ancestry#arrangement) and [elhoyos](https://github.com/mceachen/closure_tree/issues/11)
+HT: [ancestry](https://github.com/stefankroes/ancestry#arrangement) and [elhoyos](https://github.com/ClosureTree/closure_tree/issues/11)
### Eager loading
Since most of closure_tree's methods (e.g. `children`) return regular `ActiveRecord` scopes, you can use the `includes` method for eager loading, e.g.
@@ -303,17 +303,17 @@
```ruby
File.open("example.dot", "w") { |f| f.write(Tag.root.to_dot_digraph) }
```
Then, in a shell, ```dot -Tpng example.dot > example.png```, which produces:
-![Example tree](https://raw.github.com/mceachen/closure_tree/master/img/example.png)
+![Example tree](https://raw.github.com/ClosureTree/closure_tree/master/img/example.png)
If you want to customize the label value, override the ```#to_digraph_label``` instance method in your model.
Just for kicks, this is the test tree I used for proving that preordered tree traversal was correct:
-![Preordered test tree](https://raw.github.com/mceachen/closure_tree/master/img/preorder.png)
+![Preordered test tree](https://raw.github.com/ClosureTree/closure_tree/master/img/preorder.png)
### Available options
When you include ```has_closure_tree``` in your model, you can provide a hash to override the following defaults:
@@ -482,11 +482,11 @@
Several methods, especially ```#rebuild``` and ```#find_or_create_by_path```, cannot run concurrently correctly.
```#find_or_create_by_path```, for example, may create duplicate nodes.
Database row-level locks work correctly with PostgreSQL, but MySQL's row-level locking is broken, and
erroneously reports deadlocks where there are none. To work around this, and have a consistent implementation
-for both MySQL and PostgreSQL, [with_advisory_lock](https://github.com/mceachen/with_advisory_lock)
+for both MySQL and PostgreSQL, [with_advisory_lock](https://github.com/ClosureTree/with_advisory_lock)
is used automatically to ensure correctness.
If you are already managing concurrency elsewhere in your application, and want to disable the use
of with_advisory_lock, pass ```with_advisory_lock: false``` in the options hash:
@@ -497,29 +497,38 @@
```
Note that you *will eventually have data corruption* if you disable advisory locks, write to your
database with multiple threads, and don't provide an alternative mutex.
+## I18n
+You can customize error messages using [I18n](http://guides.rubyonrails.org/i18n.html):
+
+```yaml
+en-US:
+ closure_tree:
+ loop_error: Your descendant cannot be your parent!
+```
+
## FAQ
### Are there any how-to articles on how to use this gem?
Yup! [Ilya Bodrov](https://github.com/bodrovis) wrote [Nested Comments with Rails](http://www.sitepoint.com/nested-comments-rails/).
### Does this work well with ```#default_scope```?
-**No.** Please see [issue 86](https://github.com/mceachen/closure_tree/issues/86) for details.
+**No.** Please see [issue 86](https://github.com/ClosureTree/closure_tree/issues/86) for details.
### Can I update parentage with `update_attribute`?
**No.** `update_attribute` skips the validation hook that is required for maintaining the
hierarchy table.
### Can I assign a parent to multiple children with ```#update_all```?
-**No.** Please see [issue 197](https://github.com/mceachen/closure_tree/issues/197) for details.
+**No.** Please see [issue 197](https://github.com/ClosureTree/closure_tree/issues/197) for details.
### Does this gem support multiple parents?
No. This gem's API is based on the assumption that each node has either 0 or 1 parent.
@@ -574,15 +583,15 @@
bundle install
```
### Object destroy fails with MySQL v5.7+
-A bug was introduced in MySQL's query optimizer. [See the workaround here](https://github.com/mceachen/closure_tree/issues/206).
+A bug was introduced in MySQL's query optimizer. [See the workaround here](https://github.com/ClosureTree/closure_tree/issues/206).
### Hierarchy maintenance errors from MySQL v5.7.9-v5.7.10
-Upgrade to MySQL 5.7.12 or later if you see [this issue](https://github.com/mceachen/closure_tree/issues/190):
+Upgrade to MySQL 5.7.12 or later if you see [this issue](https://github.com/ClosureTree/closure_tree/issues/190):
Mysql2::Error: You can't specify target table '*_hierarchies' for update in FROM clause
## Testing with Closure Tree
@@ -615,26 +624,26 @@
```
## Testing
-Closure tree is [tested under every valid combination](http://travis-ci.org/#!/mceachen/closure_tree) of
+Closure tree is [tested under every valid combination](http://travis-ci.org/#!/ClosureTree/closure_tree) of
* Ruby 2.2, 2.3
-* ActiveRecord 4.2 and 5.0
+* ActiveRecord 4.2, 5.0, and 5.1
* PostgreSQL, MySQL, and SQLite. Concurrency tests are only run with MySQL and PostgreSQL.
Assuming you're using [rbenv](https://github.com/sstephenson/rbenv), you can use ```tests.sh``` to
run the test matrix locally.
## Change log
-See the [change log](https://github.com/mceachen/closure_tree/blob/master/CHANGELOG.md).
+See the [change log](https://github.com/ClosureTree/closure_tree/blob/master/CHANGELOG.md).
## Thanks to
* The 45+ engineers around the world that have contributed their time and code to this gem
- (see the [changelog](https://github.com/mceachen/closure_tree/blob/master/CHANGELOG.md)!)
+ (see the [changelog](https://github.com/ClosureTree/closure_tree/blob/master/CHANGELOG.md)!)
* https://github.com/collectiveidea/awesome_nested_set
* https://github.com/patshaughnessy/class_factory
* JetBrains, which provides an [open-source license](http://www.jetbrains.com/ruby/buy/buy.jsp#openSource) to
[RubyMine](http://www.jetbrains.com/ruby/features/) for the development of this project.