Register to participate in forum discussions.

Tag cloud not as expected

I've noticed both on our site at and at the OSU Library site that the tag cloud is not behaving as it used to. A tag that has been applied to more than one guide are showing up multiple times in the cloud rather than being counted in the background and then styled accordingly. I also noticed that they're all being flagged as css4 regardless of the number of occurences. Is this an issues with the acts_as_taggable_on_steroids plugin?

And a related question -- we'd like to order the tags alphabetically rather than in the order in which they happened to have first been applied to a guide. I've tried to change the :order stanza in lib/acts_as_taggable.rb to sort first by #{Tag.table_name}.name and then by count DESC, but I suspect that the sql logic would probably also need to be altered to enable an alpha sort and I don't have the depth to attempt it.

Neither of these is critical, but it would be nice to have the cloud back and alpha sorting as an option. Thanks in advance for any help you can offer to resolve them.



Hi Steve,Thanks for letting

Hi Steve,

Thanks for letting us know about the tag cloud. I will look into it and push out a fix. 

 I will also look to see about ording the tags on a guide.


Tag Plugin

Hi Steve,

So it seems that the  acts_as_taggable_on_steroids plugin needs updating. You can go ahead and download the new version from and replace the folder in vender/plugins. That should get the tag cloud working again. 


Yes, cloud is back to normal

Thanks, Kim, the new version did fix the issue with duplicate entries showing up in the tag cloud.


Tag Order

So you want the tags in the cloud ordered or the tags on the guides ordered?

Alphabetical tags in cloud

Hi again Kim,

We were hoping to be able to list the tags in the tag cloud in alphabetical order instead of the order in which they were added to guides in our Library ala Carte  instance.  I've tried changing the line

:order => options[:order] || "count DESC, #{Tag.table_name}.name"

in vendor/plugins/acts_as_taggable_on_steroids/lib/acts_as_taggble.rb

to reverse the order to

:order => options[:order] || "#{Tag.table_name}.name, count DESC"

but that doesn't work and I assume that there may need to be changes to either the other parts of the join and query or to the group command below it?


Tag Cloud order

The tag cloud is currenlty ordered by the created at timestamp in descending order. I do it that way because I limit the tag cloud to only show 100 tags starting from 1 year ago. Else the cloud could potentially get huge if not limited and I want to show the newest tags hence order by created at. So if you want to list them alabetically you will need to think about how to handle a potentially big cloud and how to show them (i.e. so you don't just get A-C listed for example). 

The place to make the change is in the app not the plugin. You need to edit the following files:

/app/controller/srg_controlller.rb , ica_controller.rb, ort_controller.rb


Search for @tags and edit this line:

.tag_counts(:start_at =>, :conditions =>["published = ?", true], :order => 'taggings.created_at desc', :limit => 100)

You can mess with the order and limit clause. See this documentation about what you can do:

# Calculate the tag counts for all tags.
    # :start_at - Restrict the tags to those created after a certain time
    # :end_at - Restrict the tags to those created before a certain time
    # :conditions - A piece of SQL conditions to add to the query
    # :limit - The maximum number of tags to return
    # :order - A piece of SQL to order by. Eg 'count desc' or 'taggings.created_at desc'
    # :at_least - Exclude tags with a frequency less than the given value
    # :at_most - Exclude tags with a frequency greater than the given value


If you get it working, please let us know what worked!



I think changing order to name asc should work.

Tags now in alpha order

Thanks so much for the specific tips from earlier in the summer, sorry I didn't get back into the forum to see them sooner. I just edited the three controller files on our instance to remove the date filter and to change the sort order to alpha by name as you recommended. I did have to change the table from taggings to in the :order stanza, but it works just fine:

 @tags = Guide.tag_counts(:conditions =>["published = ?", true], :order => '', :limit => 100)

 This is just what we needed, as we have a limited number of tags from a controlled list and don't have the issues of huge numbers of them showing up in the cloud.


Syndicate content