-
Notifications
You must be signed in to change notification settings - Fork 210
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
Updating counts in response to changes in middle of relation chain #125
Comments
Yeah, I think you've hit on a real bug here. I don't think there's any handling on the models in the middle of a chain. Kind of surprising this hasn't come up before, actually. 😄 I can't promise I'll find the time to work on this anytime soon. But I'd be very happy to review a PR if you found the time. Thanks for reporting this. |
fwiw, we actually ran into this issue about 9 mo ago and resorted to a heavy-handed counting approach since I wasn't sure there was an easy way to handle the situation. If I find the time, I'll take a look at the code and see if I can figure out a reasonable approach |
Hi @magnusvk Thanks, |
@SakthiGurunathan07 This is not fixed. Feel free to work on a PR here, I haven't had the time to work on a fix unfortunately. |
Oooof - just had a go at fixing this but it's hard. |
Yeah, unfortunately that sounds right. |
This is not perfect solution, but works. If you want to count products for categories you must also count for subcategories.
|
We tried @lukaszludzik 's solution but it didn't work in our case. We will try to solve it using callbacks on the model. |
At the moment, it seems that counter_culture does not notice changes that happen on models in the middle of multi-level counter caches. For example, I added this code to the end of the "updates third-level counter cache on update" test, but it failed:
The text was updated successfully, but these errors were encountered: