collectiveidea/awesome_nested_set

children_count does not work

Closed this issue · 7 comments

Optional field "children_count" always 0.
Actually I can use .children method but this is advanced hit to db.
I did simple as described:

root = Category.create!(:name => 'Root')
  ch = Category.create!(:name => 'First')
  ch.move_to_child_of(root)
root.reload

@imshenitsky ooh interesting, would you be willing to contribute a failing test so that we can fix the underlying issue please?

Put on Category Model
acts_as_nested_set :counter_cache => :children_count

same problem for me even I've added acts_as_nested_set :counter_cache => :children_count

Would appreciate a failing test case for this if anyone has a chance?

Seeing the same here with Rails 4.2.3.

I added the children_count column and I'm using the counter like this:

acts_as_nested_set scope: [:commentable_id, :commentable_type], counter_cache: :children_count

Counter cache just does not update.

You can have a look here and a failing test here.

Any news?

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.