mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-04-25 05:23:36 -04:00
FIX: more protection from nil in count_with_subcategories
This commit is contained in:
parent
5f992ae34c
commit
130f0e19ec
1 changed files with 1 additions and 1 deletions
|
@ -72,7 +72,7 @@ class CategoryDetailedSerializer < BasicCategorySerializer
|
|||
end
|
||||
|
||||
def count_with_subcategories(method)
|
||||
object.subcategories.inject(object.send(method) || 0) { |sum,c| sum += c.send(method) }
|
||||
object.subcategories.inject(object.send(method) || 0) { |sum,c| sum += (c.send(method) || 0) }
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue