Fix #4014: Incorrect tag type counts on posts.

This commit is contained in:
evazion
2018-12-19 12:20:29 -06:00
parent 3adf24c0aa
commit 3e382bd831
2 changed files with 13 additions and 1 deletions

View File

@@ -21,7 +21,8 @@ class Tag < ApplicationRecord
validates :name, uniqueness: true, tag_name: true, on: :create
validates_inclusion_of :category, in: TagCategory.category_ids
after_save :update_category_cache, if: ->(rec) { rec.saved_change_to_attribute?(:category)}
before_save :update_category_cache, if: :category_changed?
before_save :update_category_post_counts, if: :category_changed?
module ApiMethods
def to_legacy_json