Added block to sort_by_ancestry method for sorting within rank. #85

wants to merge 2 commits into

10 participants


Hi! I added block to sort_by_ancestry for custom sorting.
Example: Node.sort_by_ancestry(Node.all) {|a, b| a.position <=> b.position}




+1. This just bit me today where results were being returned in different orders. Some googling turns up that quick sort (what sort_by) uses isn't stable and may very well swap the position of elements with the same value for the sorted key. Yuck :/


+1 would love to see this merged into master





@StefanH StefanH pushed a commit that referenced this pull request May 7, 2013
Stefan Henzen added test for #85 39e2268

Merged & closed by 39e2268

@StefanH StefanH closed this May 7, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment