FIX: sort using ruby to avoid N+1 queries (PR #10915)

We are using preload to load tags into topics. When later we try to use order or pluck it is causing N+1

Usually, topics don’t have many tags so sorting using ruby should be reasonably performant.

GitHub

@SamSaffron what is your opinion here? Sorting using ruby is fine or should we go deeper and find a way to sort with SQL?

I am super fine just sorting in Ruby, I think this should be good enough for now.