Currently, we are trying to determine a users ranking.
We do this by a number of joins and what inevitably comes down to:
.group("users.id").order(SUM(some_joined_value) DESC, SUM(some_other_joined_value) DESC).pluck("users.id")
Now that this is in a sorted array, I can determine what ranking they are by using Array#index on the id. The problem is that this is ~ 15,000 records, is there a way to determine the row number in the result set without loading all of the data into an array? I'm using MySQL as my database adapter.