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

Add note in guide for a counter cache caveat [ci skip] #44232

Merged

Conversation

khasinski
Copy link
Contributor

@khasinski khasinski commented Jan 21, 2022

Counter cache can hold a stale value if user changes primary key's value.
This caveat is not mentioned in guides, but according to #16159
comments it should be.

Summary

A small note for users using counter caches and updating primary keys which will result in counter cache being broken.

@rails-bot rails-bot bot added the docs label Jan 21, 2022
@khasinski khasinski force-pushed the update-docs-for-counter-cache-caveats branch from 41761ec to 37b123c Compare January 21, 2022 21:29
Copy link

@maximus242 maximus242 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable

Counter cache can hold stale value if user changes primary key's value.
This caveat is not mentioned in guides, but according to rails#16159
comments it should be.
@khasinski khasinski force-pushed the update-docs-for-counter-cache-caveats branch from 37b123c to ea22266 Compare January 22, 2022 18:33
@jonathanhefner jonathanhefner merged commit 2189d97 into rails:main Jan 22, 2022
@jonathanhefner
Copy link
Member

Thank you, @khasinski! 🎉

@khasinski khasinski deleted the update-docs-for-counter-cache-caveats branch January 22, 2022 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Counter cache doesn't update if parent model primary key changes
3 participants