Last active
August 29, 2015 13:55
-
-
Save pawel2105/8780769 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Given the following domain and scenario: | |
Topic has_many votes | |
A rails noob that has a massive dataset but little understanding into ActiveRecord query methods | |
and little SQL knowledge. | |
Using elegant and idiomatic Ruby, what is a good solution for returning all topics sorted by the | |
number of votes they have. Because of the SQL knowledge gap, you should avoid having to use SQL directly. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
But if you do have 5 million rows any kind of SQL ordering sucks as well. In those circumstances I'd probably look at using a full-blown search engine.