acts_as_hoc_avatarable 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8a72a0640879c1d94563f6d787d7b7a3f564b60
4
- data.tar.gz: 879bc30177e1d76fc0fce45dd592e3c75204074c
3
+ metadata.gz: 8c9f04d56aebca0580dca962139921e82b38c2dd
4
+ data.tar.gz: beec91128041f909bb30fef49d4f068b38c3b3d3
5
5
  SHA512:
6
- metadata.gz: f3a3ed70d5128736bfed89075d00495de6488f2092d341f3cbd4d29d47a04e9681667d96147e6ffa0fa0bd8ba8132fb7015bce1a4050d55e46f8ef414df61172
7
- data.tar.gz: fd50a10b0df2274fe50d708b69dd68b3effdec87b3f933b34a086cc6b6632123a4cbc520d4483f44dd59d58d9ff787f7d690861ff5410566e09d605502fa6529
6
+ metadata.gz: b6e2eeb0ba027837e02084930397ef7abb322663b268ec80c34db5b878029bfa48e1782a3308aa818c41135f68094eb39abcdd5ed5fa479432dcb41f660d5697
7
+ data.tar.gz: a1e4f3fae101df77af62598bcda8902e8e7b26c7ab73ce97119696b0a5a82eb561e1523204d8b6478f147d37e9015ae71fef45e3d55b348c62f72c17f43f55b0
@@ -5,6 +5,7 @@ module ActsAsHocAvatarable
5
5
 
6
6
  module ClassMethods
7
7
  def acts_as_hoc_avatarable(_options = {})
8
+ require 'digest/md5'
8
9
  has_one_attached :avatar
9
10
  attr_accessor :avatar_contents
10
11
  attr_accessor :avatar_name
@@ -15,8 +16,11 @@ module ActsAsHocAvatarable
15
16
  end
16
17
 
17
18
  def avatar_url
19
+ unless persisted?
20
+ return nil
21
+ end
18
22
  return Rails.application.routes.url_helpers.rails_blob_url(avatar, host: ActsAsHocAvatarable.configuration.default_host) if avatar.attached?
19
- return "https://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email)}" if ActsAsHocAvatarable.configuration.fallback_to_gravatar
23
+ return "https://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(email ||= '')}" if ActsAsHocAvatarable.configuration.fallback_to_gravatar
20
24
  return nil
21
25
  end
22
26
 
@@ -1,3 +1,3 @@
1
1
  module ActsAsHocAvatarable
2
- VERSION = "0.1.12"
2
+ VERSION = "0.1.13"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_hoc_avatarable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gert Lavsen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-09-11 00:00:00.000000000 Z
11
+ date: 2018-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mini_magick