FIX: more protection from nil in count_with_subcategories

This commit is contained in:
Neil Lalonde 2014-02-07 11:38:22 -05:00
parent 5f992ae34c
commit 130f0e19ec
1 changed files with 1 additions and 1 deletions

View File

@ -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