better_record 0.15.0 → 0.15.1

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
  SHA256:
3
- metadata.gz: ce8484d1edf7ffd679a8c3e2b6cfedb3602a979cad7b63930505c53f7fbf2c44
4
- data.tar.gz: 2b7a2ba41a6670d710ac47fc8eab490f7147d005b035abdb50dc78ba1f4478dc
3
+ metadata.gz: f547a8cc802463bac755a8c63cd0a56a29820e4dff4e1fca44aaca4522113f63
4
+ data.tar.gz: 4c491bc39f6047d0c4abeb6b4a92df97facbdea967d634b9b1f912fd36cb6a79
5
5
  SHA512:
6
- metadata.gz: c9c42297037f1e6f78b009631d7790502bc39c3bdff5401c8f9ee64d36c746ddbbd6274abb49b815ae236a11d8378b8fecd7a0b2062d6a705c3e820b4117452e
7
- data.tar.gz: 5956669acd747dfdc77fc6feaeb9cd6e56d2b4bb51483e66da7e563bc9fb6e61b6a86b2af4f36974372b65c7e1a514dc08532f27c841c2b4b4e1db845127b573
6
+ metadata.gz: b47c26116fc3921a517895e13f0f2fb9d2110829fbb08c50214a79e084ce3a710f844e5a5b582faf1d0eb63a654e05c2557081224040a1a5547f94515788cad3
7
+ data.tar.gz: 2140d13ad729a20cd2545d0884d4ecfad9cd9c2e20a921f66314050d5a87183dabd5293feb36a1dda5ec5464cfeaf11b4bf0c218a14ed194c3c6e39242236c72
@@ -3,20 +3,31 @@ module BetterRecord
3
3
  queue_as :default
4
4
 
5
5
  def perform(**params)
6
- if record = params[:model].constantize.find_by(params[:query].deep_symbolize_keys)
7
- blob = record.__send__(params[:attachment]).blob
8
- tmp = Tempfile.new
9
- tmp.binmode
10
- tmp.write(blob.service.download(blob.variant(params[:options]).processed.key))
11
- tmp.flush
12
- tmp.rewind
13
- record.__send__(params[:attachment]).attach(
14
- io: tmp,
15
- filename: blob.filename,
16
- content_type: blob.content_type
17
- )
18
- blob.purge_later
19
- params[:backup_action].present? && record.__send__(params[:backup_action])
6
+ begin
7
+ if record = params[:model].constantize.find_by(params[:query].deep_symbolize_keys)
8
+ blob = record.__send__(params[:attachment].to_sym).blob
9
+ tmp = Tempfile.new
10
+ tmp.binmode
11
+ tmp.write(blob.service.download(blob.variant(params[:options]).processed.key))
12
+ tmp.flush
13
+ tmp.rewind
14
+ record.__send__(params[:attachment]).attach(
15
+ io: tmp,
16
+ filename: blob.filename,
17
+ content_type: blob.content_type
18
+ )
19
+ begin
20
+ blob.purge_later
21
+ rescue
22
+ end
23
+ params[:backup_action].present? && record.__send__(params[:backup_action].to_sym)
24
+ end
25
+ true
26
+ rescue
27
+ p $!.to_s
28
+ p $!.message
29
+ p $!.backtrace.first(25)
30
+ return false
20
31
  end
21
32
  end
22
33
  end
@@ -68,8 +68,8 @@ module BetterRecord
68
68
  __send__ (shrink_later ? :perform_later : :perform_now), {
69
69
  model: self.class.to_s,
70
70
  query: {id: self.id},
71
- attachment: avatar_name,
72
- backup_action: :"cache_current_#{avatar_name}",
71
+ attachment: avatar_name.to_s,
72
+ backup_action: "cache_current_#{avatar_name}",
73
73
  options: shrink_large_image
74
74
  }
75
75
  rescue
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BetterRecord
4
- VERSION = '0.15.0'
4
+ VERSION = '0.15.1'
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.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sampson Crowley