Sorting tags alphabetically

I am trying to output an alphabetically sorted list of tags.

If I use: <% blog.tags.sort{ |a,b| a.downcase <=> b.downcase }.each do |tag, articles| %>, I get a NoMethodError:

undefined method downcase’ for #`.

I can use <% blog.tags.sort{ |a,b| a <=> b }.each do |tag, articles| %> to sort alphabetically by uppercase then lowercase which is passable but not what I intended.

Could someone point out my head-slapping error?

what’s the class of a/b? seems that it’s not string

Thank you, that was the ticket. My code should have been:

<% blog.tags.sort{ |a,b| a.to_s.downcase   <=> b.to_s.downcase   }.each do |tag, articles| %>

Works fine and dandy now