Sha256: fb741f8f0ba133603c43da556d43fd9f94773c9f20c6eae9ef6f061b43728074

Contents?: true

Size: 439 Bytes

Versions: 20

Compression:

Stored size: 439 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
        "https://www.gravatar.com/avatar/" + Digest::MD5.hexdigest(email.to_s) + "?default=mm&size=200"
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
dorsale-3.8.1 app/models/dorsale/users/avatar.rb
dorsale-3.8.0 app/models/dorsale/users/avatar.rb
dorsale-3.7.8 app/models/dorsale/users/avatar.rb
dorsale-3.7.7 app/models/dorsale/users/avatar.rb
dorsale-3.7.6 app/models/dorsale/users/avatar.rb
dorsale-3.7.5 app/models/dorsale/users/avatar.rb
dorsale-3.7.4 app/models/dorsale/users/avatar.rb
dorsale-3.7.2 app/models/dorsale/users/avatar.rb
dorsale-3.7.1 app/models/dorsale/users/avatar.rb
dorsale-3.7.0 app/models/dorsale/users/avatar.rb
dorsale-3.6.1 app/models/dorsale/users/avatar.rb
dorsale-3.6.0 app/models/dorsale/users/avatar.rb
dorsale-3.5.2 app/models/dorsale/users/avatar.rb
dorsale-3.5.1 app/models/dorsale/users/avatar.rb
dorsale-3.5.0 app/models/dorsale/users/avatar.rb
dorsale-3.4.0 app/models/dorsale/users/avatar.rb
dorsale-3.3.0 app/models/dorsale/users/avatar.rb
dorsale-3.2.0 app/models/dorsale/users/avatar.rb
dorsale-3.1.7 app/models/dorsale/users/avatar.rb
dorsale-3.1.6 app/models/dorsale/users/avatar.rb