benedikt/mongoid-tree — pull request #20 by nickhoffman (2011-11-01 02:23:20+00:00)
Title: Ancestors are returned in their correct order when using Tree::Ordering

Hey there, Benedikt. I just found a bug with ancestors and Tree::Ordering.

If you have a tree like this:

```
- root:
- level_1_a
- level_1_b:
- level_2_a:
- leaf
```

`leaf.ancestors` returns `[root, level_2_a, level_1_b]`, which is obviously incorrect.

This occurs because of the default scope of ascending position. `level_2_a`'s position is 0, `level_1_b`'s position 1, so MongoDB sorts `level_2_a` before `level_1_b`.

The solution is to make Tree::Ordering query the base class *unscoped*.

Cheers,
Nick