collectiveidea/awesome_nested_set — pull request #241 by shekibobo (2014-03-11 03:47:02+00:00)
Title: Allow use of non-id primary column

Fixes #239.

Note, I don't currently have any specs for this. I worked this out against a user import as was described in #239, and finally got it to build and function properly. If anyone might have any hints on how we might test this, I'd love to get this production-ready.

Where a nested-set association is defined by a non-`id` primary key, e.g.

```ruby
class User < ActiveRecord::Base
# association based on :uuid and :parent_uuid
belongs_to :parent, class_name: 'User', foreign_key: :parent_uuid, primary_key: :uuid, inverse_of: :children
has_many :children, class_name: 'User', foreign_key: :parent_uuid, primary_key: :uuid , inverse_of: :parent
end
```

We can now, instead use `awesome_nested_set`, which just got a whole lot more awesome:

```ruby
class User < ActiveRecord::Base
acts_as_nested_set parent_column: :parent_uuid, primary_column: :uuid
end
```

Awesome.