Created
January 7, 2013 18:24
-
-
Save thurloat/4477220 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
if sort? and (sort.get "items").length > 0 | |
parts = for item in (sort.get "items") | |
dir = if item[0] == "-"? then "DESC" else "ASC" | |
"#{ if dir == "ASC" then item else item.slice 1 } #{ dir }" | |
sql += " ORDER BY #{ parts.join ", " }" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment