mceachen/closure_tree — pull request #40 by calexicoz (2013-02-06 06:40:38+00:00)
Title: Allow UUIDs and other types of non-integer primary keys

Hi Matthew,

Here is a starting point to integrate UUIDs. The change to `lib/closure_tree/acts_as_tree.rb` are pretty minimal. I copied most of the tests from `tag_spec` as a starting point, just to make sure everything passed. One or two had to be modified, ie `array =~ array` instead of `array == array` as the natural order of UUIDs is not necessarily the creation order.

To be honest rather than copy/pasting, I'd rather simply switch one of the existing models to UUID and keep the same tests, or use something like `[Node, Tag].each {|klass| ...}`.

Let me know what you think.

Also, because of the way quoting works, this should allow for binary keys as well, or other types that are neither strings nor integers.