ActsAsTaggableOn Count

30 views
Skip to first unread message

Kevin Lawrence

unread,
Jan 28, 2013, 7:26:45 PM1/28/13
to communi...@googlegroups.com
I'm trying to implement something like stackoverflow's tags popover, where you can mouseover any tag and see the number of posts with that tag.

I'm trying to do something like this:

topic = Topic.first
topic.tags.each do |tag|
    puts "#{tag.name#{tag.count}"
end

But the count is never populated.

I see, from the way that the tag cloud works in TagsController, that there is a method Tag.counts() that will get me the count but I can't figure out how to get from here to there. What am I missing?

I see also that there is a migration that adds a column taggings_count to the Tag table but that is never updated as far as I can tell.

Can I get some advice?

Thanks in advance, 

Kevin

Jim Ruther Nill

unread,
Jan 28, 2013, 7:48:43 PM1/28/13
to communi...@googlegroups.com

Can I get some advice?

Thanks in advance, 

Kevin

--
You received this message because you are subscribed to the Google Groups "CommunityEngine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to communityengi...@googlegroups.com.
To post to this group, send email to communi...@googlegroups.com.
Visit this group at http://groups.google.com/group/communityengine?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com

Kevin Lawrence

unread,
Jan 28, 2013, 8:00:32 PM1/28/13
to communi...@googlegroups.com
On Mon, Jan 28, 2013 at 4:48 PM, Jim Ruther Nill <jvn...@gmail.com> wrote:

Thanks, Jim. That's exactly what I needed. I was missing the param to pass in to tag_counts_on

Kevin 
Reply all
Reply to author
Forward
0 new messages