We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
recent rails versions come with a nice cache_key method that concatenates
class_name + id + timestamp
this together with the ActiveRecord "touch" method would work great because cache expiration is automatic when the record gets updated.
this method "cache_key" is being overwritten in the "cache_fu" plugin.
lib/acts_as_cached/cache_methods.rb:265
265 def cache_key 266 self.class.cache_key(cache_id) 267 end
I was thinking that maybe something like this would do:
return super if self.class.superclass.to_s == 'ActiveRecord::Base' self.class.cache_key(cache_id)
So well, may be it needs a little bit more code and tests to be robust. but you sort of get the idea.
I forked, and was thinking of making the changes but thought of confirming this
Thanks for rip, cijoe, network-graphs?? and more!
The text was updated successfully, but these errors were encountered:
I spent a few more minutes on making it more robust
def should_override_cache_key? return true unless self.respond_to? :class return true unless self.class.respond_to? :superclass return true unless self.class.superclass.respond_to? :to_s return true unless self.class.superclass.to_s == 'ActiveRecord::Base' !self.class.respond_to? :cache_key end def cache_key should_override_cache_key? ? self.class.cache_key(cache_id) : super end
Sorry, something went wrong.
No branches or pull requests
recent rails versions come with a nice cache_key method that concatenates
class_name + id + timestamp
this together with the ActiveRecord "touch" method would work great because
cache expiration is automatic when the record gets updated.
this method "cache_key" is being overwritten in the "cache_fu" plugin.
I was thinking that maybe something like this would do:
So well, may be it needs a little bit more code and tests to be robust.
but you sort of get the idea.
I forked, and was thinking of making the changes but thought of confirming this
Thanks for rip, cijoe, network-graphs?? and more!
The text was updated successfully, but these errors were encountered: