-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Object that isn't fetched doesn't pull associations from cache #36
Comments
Bump. This seems weird to me as well. Are the methods only applied to objects coming back from memcache? |
I have a temporary workaround class Product < AR::Base
...
def fetch_main_category
Category.fetch(self.main_category_id)
end
end ugly, but works. |
Why aren't you just using |
It's not documented on the README. Will check, thanks! |
You're right, that is a valid bug in the documentation at least. |
cache_belongs_to has been documented, so this doesn't demonstrate a bug in the code. |
(Using master branch)
Product
class hasExpected: even when
Product.first
is called, the calls offetch_main_category
will get it from DB, put theCategory
object in cache and next calls ofProduct.first.fetch_main_category
will read it from cache.The text was updated successfully, but these errors were encountered: