Created
January 24, 2011 23:25
-
-
Save mikelovesrobots/794204 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
named_scope :sort_string, lambda do |type| | |
order_string = case type | |
when 'score' | |
"score desc" | |
when 'date' | |
"created_at desc" | |
else | |
raise "Unknown type passed into sort_string: #{type.inspect}" | |
end | |
{:order => order_string} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment