Sha256: 00768e80c73256fbf8f9a0117bcada7c9889a805173f6f5f2d7958e0bee2db08

Contents?: true

Size: 468 Bytes

Versions: 36

Compression:

Stored size: 468 Bytes

Contents

module Dorsale::Users::Avatar
  def self.included(user_model)
    user_model.class_eval do
      mount_uploader :avatar, ::Dorsale::AvatarUploader

      def avatar_url
        local_avatar_url || gravatar_url
      end

      def local_avatar_url
        avatar.try(:url)
      end

      def gravatar_url
        gravatar_id = Digest::MD5.hexdigest(email.to_s)
        "https://www.gravatar.com/avatar/#{gravatar_id}?default=mm&size=200"
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
dorsale-4.0.0 app/models/dorsale/users/avatar.rb
dorsale-3.20.0 app/models/dorsale/users/avatar.rb
dorsale-3.19.1 app/models/dorsale/users/avatar.rb
dorsale-3.19.0 app/models/dorsale/users/avatar.rb
dorsale-3.18.0 app/models/dorsale/users/avatar.rb
dorsale-3.17.0 app/models/dorsale/users/avatar.rb
dorsale-3.16.0 app/models/dorsale/users/avatar.rb
dorsale-3.15.0 app/models/dorsale/users/avatar.rb
dorsale-3.14.11 app/models/dorsale/users/avatar.rb
dorsale-3.14.10 app/models/dorsale/users/avatar.rb
dorsale-3.14.9 app/models/dorsale/users/avatar.rb
dorsale-3.14.8 app/models/dorsale/users/avatar.rb
dorsale-3.14.7 app/models/dorsale/users/avatar.rb
dorsale-3.14.6 app/models/dorsale/users/avatar.rb
dorsale-3.14.5 app/models/dorsale/users/avatar.rb
dorsale-3.14.4 app/models/dorsale/users/avatar.rb
dorsale-3.14.3 app/models/dorsale/users/avatar.rb
dorsale-3.14.2 app/models/dorsale/users/avatar.rb
dorsale-3.14.1 app/models/dorsale/users/avatar.rb
dorsale-3.14.0 app/models/dorsale/users/avatar.rb