Sorting an ActiveRecord hash

How about:

@tags = Tag.find(:all, :limit => 20, :conditions => "id != 22 and id != 47" , :order => "count DESC, name")

I do not have a test environment for this at hand, but depeneding on your database it should be possible.

http://dev.mysql.com/doc/refman/4.1/en/order-by-optimization.html