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

[question] Is it possible sort hash_tree? #295

Open
wbotelhos opened this issue Jan 9, 2018 · 1 comment
Open

[question] Is it possible sort hash_tree? #295

wbotelhos opened this issue Jan 9, 2018 · 1 comment
Labels

Comments

@wbotelhos
Copy link
Contributor

I'm using hash_tree so build a comment tree where each comment has more or less likes.
I would like to sort the tree to put the comment with more like on top, but always inside each parent.

A parent comment with poor like will be keep above, even when its children has good rating. Just because I would like to sort from the root until the deeper one.

Any way to arquive it?
Thanks for this great gem. (:

@wbotelhos
Copy link
Contributor Author

I tried to look up into code, but there is no possibility to pass the order direction or more than one order. I would like to do that:

has_closure_tree order: 'rating desc, created_at desc'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants