better_record 0.18.2 → 0.18.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f29175178880d4a7a9cf33d526c4413306e20fbdc3475ff3e29c5d8aaa6e9402
4
- data.tar.gz: 88684f5a4f39fb50bcd3ddac3bd6578bdd9a2ff2f0b3f7910dec6ec22160ba47
3
+ metadata.gz: e03815d2331b4c05a3705bffcca86203bfccaba79d7bfe8505774ca504b5fef7
4
+ data.tar.gz: 8437469c63dd94551197cac03193b91c9f45406abec4ade03a70cf0a667df88f
5
5
  SHA512:
6
- metadata.gz: 3f4cca4564a0009bd7c952b4f34f24afeb5aea6e94ac2501776685834f5fd71b1c369f60e15900330d44e9fa0a98b2b34a841cd5421f60bceec86311c5770666
7
- data.tar.gz: 8e00305d1efc5f7f795e57e0961165b6fcc7b69834367854b78a81c67c13d4162554fe6461809d9e035a06cf2a1147a2e3910d9e9d0d9c42b52545013a589b89
6
+ metadata.gz: 2b3ec051f5ac0362bd6dc08c8dad67eead886a54ab7c4e1e260420e8cfe3199c4d9ca8118ea2cdb28615bb8f1a37c5d8cd582988c98f602cf748c2e4bcee7dbc
7
+ data.tar.gz: 76611ca55399b221de2f395af93a0f295daa15131d19368b1760cc82d124ad47c263ce0d89aeee096f71163ebeee35be5494063ea8f70b7707afd38e9b64f324
@@ -8,12 +8,12 @@ module BetterRecord
8
8
  blob = record.__send__(params[:attachment].to_sym).blob
9
9
  tmp = Tempfile.new
10
10
  tmp.binmode
11
- tmp.write(blob.service.download(blob.variant(params[:options]).processed.key))
11
+ tmp.write(blob.service.download(blob.variant(blob.filename.to_s =~ /-resized?/ ? {resize: '70%'} : params[:options]).processed.key))
12
12
  tmp.flush
13
13
  tmp.rewind
14
- record.__send__(params[:attachment]).attach(
14
+ record.__send__(params[:attachment]).reload.attach(
15
15
  io: tmp,
16
- filename: blob.filename.to_s.sub(/(\.[^.]*)$/, '-resized\1'),
16
+ filename: blob.filename.to_s.sub(/(\.[^.]*)$/, '-resized\1').sub(/(-resized)+/, '-resized'),
17
17
  content_type: blob.content_type
18
18
  )
19
19
  tmp.close
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BetterRecord
4
- VERSION = '0.18.2'
4
+ VERSION = '0.18.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: better_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.2
4
+ version: 0.18.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sampson Crowley