Guest User

Untitled

a guest
Jul 21st, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. named_scope :sort_string, lambda do |type|
  2. order_string = case type
  3. when 'score'
  4. "score desc"
  5. when 'date'
  6. "created_at desc"
  7. else
  8. raise "Unknown type passed into sort_string: #{type.inspect}"
  9. end
  10.  
  11. {:order => order_string}
  12. end
Add Comment
Please, Sign In to add comment