Topic: sorting descending order
Hi, I have an object which I want to sort by popularity (default sort is by date).
I can sort using:
ttssorted = tts.sort do |a,b| a.popularity <=> b.popularity end
Problem is it sorts in ascending order.
I can fix it by doing:
but that seems like its inefficient, is there a way to sort in descending order on the first try?