Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow UUIDs and other types of non-integer primary keys #40

Merged
merged 5 commits into from
Feb 10, 2013
Merged

Allow UUIDs and other types of non-integer primary keys #40

merged 5 commits into from
Feb 10, 2013

Conversation

calexicoz
Copy link

Hi Matthew,

(In reference to #39)

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.

@mceachen
Copy link
Collaborator

mceachen commented Feb 7, 2013

Great, thanks!

I'll merge into a new branch and see if there's a better way we can test this out, instead of duplicating the tags spec.

@calexicoz
Copy link
Author

Cool.

@mceachen mceachen merged commit 03b2a45 into ClosureTree:master Feb 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants