BigW Consortium Gitlab

avatar_uploader.rb 335 Bytes
Newer Older
1 2 3
# encoding: utf-8

class AvatarUploader < CarrierWave::Uploader::Base
4 5
  include UploaderHelper

6 7 8 9 10 11 12 13 14 15 16 17
  storage :file

  after :store, :reset_events_cache

  def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  end

  def reset_events_cache(file)
    model.reset_events_cache if model.is_a?(User)
  end
end