Created
February 13, 2012 16:05
-
-
Save DavidQL/1817882 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User | |
def eager_load_foo | |
if Rails.cache.fetch(self.foo_cache_key).nil? # a cache of the current iterator doesn't exist, so create it | |
Rails.cache.write(self.foo_cache_key, Foo.to_json) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment