mbleigh / acts-as-taggable-on

A tagging plugin for Rails applications that allows for custom tagging along dynamic contexts.
http://mbleigh.lighthouseapp.com/projects/10116-acts-as-taggable-on
MIT License
4.98k stars 1.19k forks source link

taggings_count not updating in act as taggable #929

Open vishaltps opened 5 years ago

vishaltps commented 5 years ago

I used gem act_as_taggable in my project. Below is my model

post.rb

acts_as_taggable_on :moods
has_many :taggings, as: :taggable, dependent: :destroy

It is working fine, but the only issue is taggings_count field of tags count isn't updating.

Am I missing something to add any extra config? Because as per my understanding it should update automatically

vishaltps commented 5 years ago

I resolved this issue, We don't need to write has many association of taggings. I removed below association and everything is working fine now.

has_many :taggings, as: :taggable, dependent: :destroy