ZK Zhao
ZK Zhao

Reputation: 21523

Show the times of a tag being tagged to a specific object using acts-as-taggable-on in Rails

Sorry for such a long topic, that what I can only express with these words.

For example: @article=Article.new

and users could tag @article differently, with their own tag( like good)

Then, how can I show the good tag how many times being taged to the @article?

After searching around, I just find solutions to count the overall times a tag being tagged( In this case, how many times the 'good' being used on Article.all), like :Acts-as-taggable-on find all tags by context. Just like what we have in stackoverflow's tag feature

Upvotes: 0

Views: 33

Answers (1)

jvnill
jvnill

Reputation: 29599

Use Article.tagged_with('good').count

Upvotes: 0

Related Questions