cache_method
cache_method copied to clipboard
Suggestion for Readme - caching a class method
I was scratching my head for a while as to how to cache a class method. I figured out that you can do it by calling cache_method on a method inside a singleton class definition. Perhaps this is obvious to others but maybe worth adding to Readme. E.g.
class Blog < ActiveRecord::Base
class << self
def method_want_to_cache
...
end
cache_method :method_want_to_cache
end
end