diff options
author | Sam Stephenson <sam@37signals.com> | 2018-02-07 18:26:19 -0600 |
---|---|---|
committer | Sam Stephenson <sam@37signals.com> | 2018-02-07 18:26:19 -0600 |
commit | 68d350ddacedf604717f0d1074d7624fa57757c2 (patch) | |
tree | a01852130448e37368ed2fd4af7e930e6c2cd0f2 /lib/active_text/attachments/caching.rb | |
parent | e22ba227a694b8426e69dbce640c5b0e4f39f574 (diff) | |
download | rails-68d350ddacedf604717f0d1074d7624fa57757c2.tar.gz rails-68d350ddacedf604717f0d1074d7624fa57757c2.tar.bz2 rails-68d350ddacedf604717f0d1074d7624fa57757c2.zip |
Initial import from BC3 RichText
Diffstat (limited to 'lib/active_text/attachments/caching.rb')
-rw-r--r-- | lib/active_text/attachments/caching.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/active_text/attachments/caching.rb b/lib/active_text/attachments/caching.rb new file mode 100644 index 0000000000..b0194170e1 --- /dev/null +++ b/lib/active_text/attachments/caching.rb @@ -0,0 +1,14 @@ +module ActiveText + module Attachments + module Caching + def cache_key(*args) + [self.class.name, cache_digest, *attachable.cache_key(*args)].join("/") + end + + private + def cache_digest + Digest::SHA256.hexdigest(node.to_s) + end + end + end +end |