summaryrefslogtreecommitdiff
path: root/app/uploaders
diff options
context:
space:
mode:
authorDrew Blessing <drew.blessing@buckle.com>2013-12-11 09:30:22 -0600
committerDrew Blessing <drew.blessing@buckle.com>2013-12-11 09:30:22 -0600
commitc26d392b1a160ae357a63cf160daeb81a0dd8ece (patch)
tree79104023aea917518515d66888b477f6e0f03fc9 /app/uploaders
parent2934e7a9627bb92ab9367923cdbcbaa13f7843d4 (diff)
downloadgitlab-ce-c26d392b1a160ae357a63cf160daeb81a0dd8ece.tar.gz
Expire event cache on avatar creation/removal
Diffstat (limited to 'app/uploaders')
-rw-r--r--app/uploaders/attachment_uploader.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/uploaders/attachment_uploader.rb b/app/uploaders/attachment_uploader.rb
index 98794c9470b..b122b6c8658 100644
--- a/app/uploaders/attachment_uploader.rb
+++ b/app/uploaders/attachment_uploader.rb
@@ -3,6 +3,8 @@
class AttachmentUploader < CarrierWave::Uploader::Base
storage :file
+ after :store, :reset_events_cache
+
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
@@ -27,4 +29,8 @@ class AttachmentUploader < CarrierWave::Uploader::Base
def file_storage?
self.class.storage == CarrierWave::Storage::File
end
+
+ def reset_events_cache(file)
+ model.reset_events_cache if model.is_a?(User)
+ end
end