Simple, simple method caching for ActiveRecord models.
class User < ActiveRecord::Base
include Cacheable
def related_events
Event.expensive_relationships_finder_for(self)
end
cache_method :related_events, to_a: true
end
:key- Optional time column to use for thecache_keymethod. Must respond toutc.to_s(:number):to_a- Should we callto_aon the results?