This project is archived and is in readonly mode.

#5731 ✓wontfix
joerodriguez (at gmail)


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...

Comments and changes to this ticket

  • Robert Pankowecki
  • laserlemon

    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

    if I have to expire the cache myself anyway.

  • David Trasbo

    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.

  • af001

    af001 May 5th, 2011 @ 03:00 AM


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=""></a>