Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Add Comment
Please, Sign In to add comment