A platform for community discussion. Free, open, simple.
PERF: Prefer `exists?` instead of loading AR object.
Guo Xiang Tan9ef61e0af56a
diff --git a/app/models/topic.rb b/app/models/topic.rbindex 78cc39584ef..d179b12ee8f 100644--- a/app/models/topic.rb+++ b/app/models/topic.rb@@ -655,7 +655,7 @@ SQLenddef changed_to_category(new_category)- return true if new_category.blank? || Category.find_by(topic_id: id).present?+ return true if new_category.blank? || Category.exists?(topic_id: id)return false if new_category.id == SiteSetting.uncategorized_category_id && !SiteSetting.allow_uncategorized_topicsTopic.transaction do