Rails acts_as_taggable_on grouped alphabetically?

Posted by Ray Dookie on Stack Overflow See other posts from Stack Overflow or by Ray Dookie
Published on 2010-03-11T05:45:27Z Indexed on 2010/03/11 5:48 UTC
Read the original article Hit count: 286

Having sorted the tag_counts hash via the following code:

sorted_tags = Contact.tag_counts.sort{ |x,y| x.name.downcase <=> y.name.downcase }

what is the easiest/most efficient way to display the tags in my view grouped by letters?

i.e A - "Alpha", "Apple", "Aza"

B - "Beta", "Bonkers"

.

.

.

Z - "Zeta", "Zimmer"

Any ideas?

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby