Hi all,
5.times { foo.association }
will produce 1 query to the DB; the result is “cached” (for want of a
better word) in a variable somewhere. However:
5.times { foo.association.count }
will run the query 5 times. Why?
I could use an association extension to cache the count value for me,
but first I want to understand whether this is a bad idea and has been
deliberately avoided?
Cheers