Created
January 30, 2009 01:13
-
-
Save dkubb/54872 to your computer and use it in GitHub Desktop.
This file contains 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
# limit/offset using Enumerable#slice | |
collection[0, 20] # LIMIT 0, 20 | |
collection[0..20] # LIMIT 0, 20 | |
# ordering using Enumerable#sort_by (will not require ParseTree) | |
collection.sort_by { |o| o.name } # ORDER BY name | |
collection.sort_by { |o| -o.name } # ORDER BY name DESC | |
collection.sort_by { |o| [ -o.name, o.age ] } # ORDER BY name DESC, age |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment