From 82fb3bd109b531d12ba94883de55b643e066b6e8 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Thu, 21 May 2015 12:29:08 -0700 Subject: [PATCH] fixes #2384 --- app/models/tag.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/models/tag.rb b/app/models/tag.rb index 429d190ac..7ccd92ca4 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -192,6 +192,11 @@ class Tag < ActiveRecord::Base if category category_id = categories.value_for(category) + # in case a category change hasn't propagated to this server yet, + # force an update the local cache. This may get overwritten in the + # next few lines if the category is changed. + tag.update_category_cache + if category_id != tag.category && !tag.is_locked? && (CurrentUser.is_builder? || tag.post_count <= 50) tag.update_column(:category, category_id) tag.update_category_cache_for_all