FIX: Don't use `:true`/`:false` symbols (#24861)

on line 252 `has_children` is set to true/false (actual booleans) which means `has_children?` was in some cases returning incorrect value…
This commit is contained in:
Jarek Radosz 2023-12-13 00:27:14 +01:00 committed by GitHub
parent 607c530252
commit 8355664c82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -886,8 +886,8 @@ class Category < ActiveRecord::Base
end
def has_children?
@has_children ||= (id && Category.where(parent_category_id: id).exists?) ? :true : :false
@has_children == :true
return @has_children if defined?(@has_children)
@has_children = (id && Category.where(parent_category_id: id).exists?)
end
def uncategorized?