Last active
October 18, 2017 07:33
-
-
Save iberianpig/f96b1906bd2d532f05cce5f706223419 to your computer and use it in GitHub Desktop.
ActiveRecordProxyのメソッドチェーンでcache_keyを提供する
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
| module CacheSupport | |
| extend ActiveSupport::Concern | |
| module ClassMethods | |
| def cache_key | |
| "#{name}/#{ids.hash}-#{maximum(:updated_at).to_i}" | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment