issues
search
stefankroes
/
ancestry
Organise ActiveRecord model into a tree structure
MIT License
3.71k
stars
458
forks
source link
Fix Rebuild counter cache
#668
Closed
kbrock
closed
1 year ago
kbrock
commented
1 year ago
Alt to #665
Before
We were casting to a fixed length char field. Some records in the middle of the tree did not get an updated counter cache.
Mysql updated counter cache to nil if there were no children.
After
Using the conversion built into
CONCAT
, so no need to use
CAST
.
All implementations update counter cache to 0 when there are no children.
More robust tests for counter caches
RongRongTeng
commented
1 year ago
🙏🏻
Alt to #665
Before
After
CONCAT
, so no need to useCAST
.