Is it possible to use counter cache on a habtm relation in rails 3 ?
I really need it to speed up my application.
There is no built in method for HABTM
but it is simple to make your own counter cache (actually I was doing it many times before I've invented counter_cache
.
Or use has_many :throught
instead of HABTM
association. I never use HABTM
because it looks awkward for me.
Related topic:
counter_cache with has_many :through
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With