Sorting the children
Closed this issue · 2 comments
guyisra commented
First of all, this gem is awesomer than awesome_nested_set since it doesnt have its bugs and compatibility issues.
I use it to have replies for messages.
I'd like the messages to be sort by the creation date (first is newest)
but i want all of the children (replies) to be sorted by date where first is oldest
How do I sort only the children?
Thanks
pyromaniac commented
Easy. Just select all comments from database ordered by lft desc
and during the output just reverse
children
pyromaniac commented
Also, you can use https://github.com/skyeagle/nested_set/blob/master/lib/nested_set/base.rb#L120 this method and do what you want with the hash.