faking children_count counter cache due to possible bug with awesome_nested_set

This commit is contained in:
David Gil
2015-08-11 19:39:52 +02:00
parent 0291f574a2
commit 575c2dd281

View File

@@ -31,4 +31,11 @@ class Comment < ActiveRecord::Base
def total_votes
votes_for.size
end
# TODO: faking counter cache since there is a bug with acts_as_nested_set :counter_cache
# Remove when https://github.com/collectiveidea/awesome_nested_set/issues/294 is fixed
# There is a test for this, so you should know if it is actually fixed.
def children_count
children.count
end
end