PERF: Prefer `exists?` instead of loading AR object.
This commit is contained in:
parent
50be06af47
commit
9ef61e0af5
|
@ -655,7 +655,7 @@ SQL
|
|||
end
|
||||
|
||||
def 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_topics
|
||||
|
||||
Topic.transaction do
|
||||
|
|
Loading…
Reference in New Issue