Module: Avatarable::ShadowMethods

Defined in:
app/models/concerns/avatarable.rb

Instance Method Summary collapse

Instance Method Details

#avatar_url(**args) ⇒ Object



32
33
34
35
36
37
# File 'app/models/concerns/avatarable.rb', line 32

def avatar_url(**args)
  # We use avatar_path instead of overriding avatar_url because of carrierwave.
  # See https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/11001/diffs#note_28659864

  avatar_path(only_path: args.fetch(:only_path, true), size: args[:size]) || super
end

#retrieve_upload(identifier, paths) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'app/models/concerns/avatarable.rb', line 39

def retrieve_upload(identifier, paths)
  upload = retrieve_upload_from_batch(identifier)

  # This fallback is needed when deleting an upload, because we may have
  # already been removed from the DB. We have to check an explicit `#nil?`
  # because it's a BatchLoader instance.
  upload = super if upload.nil?

  upload
end