Object caching

helzer
Thu, 16 Aug 2007 10:51:52 -0000

Does Rails cache all objects that are accessed during a request?

If one object is accessed several times during a request, would its
value be read from memory, or fetched from the database over and over
again?

I''m sure that objects that were passed by the controller, like
@something would be cached, because their reference is passed, but
what about other objects which might be deleted by the garbage
collection?

So, if I plan to display the same object over and over again within a
partial, for the same call, how do I make sure it''s not fetched from
the database on every render?

Thanks,
Amir