Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sort_by = 'user' # For example
- column_title = case sort_by
- when 'user'
- proc { |x| x.name }
- when 'date'
- proc { |x| x.date.strftime("%A, %e %B") }
- end
- # Later...
- column_title.call(obj)
- # => obj.name
Add Comment
Please, Sign In to add comment