This project is archived and is in readonly mode.

AR::Relation#cache_key
Reported by joerodriguez (at gmail) | September 29th, 2010 @ 01:28 PM
Provides a unique cache_key for ActiveRecord::Relation. Particularly useful when caching result sets or views:
@results = Person.babies
cache @results.cache_key do
...expensive stuff...
end
Comments and changes to this ticket
-
-
laserlemon September 29th, 2010 @ 05:16 PM
It seems like custom cache keys and custom expiration are better suited for these types of situations. A relation's cache key doesn't communicate anything about its expiration. So if another baby were added to the people table, the cache key would remain. I'd just as soon do:
@results = Person.babies cache 'people/babies' do # Expensive stuff end
if I have to expire the cache myself anyway.
-
David Trasbo October 9th, 2010 @ 08:17 PM
- State changed from new to wontfix
- Importance changed from to Low
I agree with, erm, laserlemon. Marking this wont fix for now (even though it's not really my decision). Will reopen if this develops further.
-
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>