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
--
Posted via http://www.ruby-forum.com/.
Apparently Analagous Threads
- Altering the accessor of an association collection
- HTML Output plugin
- Which object have my association extension method?
- Missing documentation for find_in_collection? Trying to drill down in a 4 level has_many association fails
- Error: file association for 'doc\html\index.html' not available or invalid
