Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

children_count not always in sync with the actual count of children #684

Open
seenanair opened this issue Aug 21, 2024 · 3 comments
Open

Comments

@seenanair
Copy link

We have been using the Ancestry gem for a while, and as part of the implementation, we are utilizing the counter_cache feature, which allows us to use the children_count column. However, we are encountering an issue where the children_count is not always in sync with the actual count of children.

I was wondering if anyone else has faced a similar issue, and if so, it would be great to hear about any solutions or possible reasons this might be happening. Could it be that the Ancestry callbacks are being interfered with, possibly due to the order in which they are executed alongside model object callbacks?

Is there a way to ensure that Ancestry updates occur after all model object callbacks have been executed?

Thank you!

@kbrock
Copy link
Collaborator

kbrock commented Aug 21, 2024

Hello @seenanair
I've had trouble reproducing this, but it is definitely has been seen before
You may want to also look at #584

@seenanair
Copy link
Author

seenanair commented Aug 21, 2024

@kbrock Thanks for your quick reply. Yes, It is hard to reproduce.
Seeing the update, I hope it is better to use rebuild_counter_cache as a fix?
Also, I can see it is not yet released. Is there any plans for a release soon?

@kbrock
Copy link
Collaborator

kbrock commented Aug 21, 2024

@seenanair I will release soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants