refile-backgrounder 0.0.2 → 0.0.3

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: 209d85302c5fe08550bf637dcdd9db50bea0bd4b
4
- data.tar.gz: 8892986ec1cd830c6e42fc909ef86f9fed5bcdb8
3
+ metadata.gz: dc837f88506852f3d00d760c8f23f1a0767721e3
4
+ data.tar.gz: 59c652b614bc52718f2dac99278659a68d632244
5
5
  SHA512:
6
- metadata.gz: fd5166522f79bd6df035b61f61d6cfc359bae23768d5119bccf055c41aec95c7a5980d6d05cfe9e5d782e83bd3efc63cbdfa6a50413c5991a559408de9f5b950
7
- data.tar.gz: c09e16c1d6fd014a3bbdbdb0261c510fe98fe186e7a0ca3e4b84c6490e71a149bd8510000be0672aa23de2a3ddf967db325d75449a5b75ec88f4064557c80bfb
6
+ metadata.gz: d32a2b27377df549723f7a3749c01ea67101e42c8382086692db88cf4cdb700bcd7ba3b69b6efb26aeee83bf41f10acb4ed43970d94a1f0886ec7c2d2018267a
7
+ data.tar.gz: c8f57d6e284ba9d0110b100c33d9a55dd8382c137729671954a1543c7a7d533e47f18218aae2214a9d3550de0e6da4aecb584aab49f022808fc45359c74cb3a1
@@ -8,8 +8,6 @@ module Refile
8
8
 
9
9
  attr_accessor :_skip_refile_backgrounder
10
10
  after_save(unless: :_skip_refile_backgrounder) do |record|
11
- metadata = record.send(name)
12
- metadata = nil unless metadata.is_a? String
13
11
  worker.perform_later record, name.to_s, metadata
14
12
  end
15
13
  end
@@ -10,15 +10,19 @@ module Refile
10
10
  super || (background? and record.send("#{name}_cache_id"))
11
11
  end
12
12
 
13
- def cache!(*)
13
+ def set(*)
14
14
  super
15
- record.send "#{name}_cache_id=", cache_id if background?
15
+ save_cache_id
16
16
  end
17
17
 
18
18
  def store!
19
19
  super unless background?
20
20
  end
21
21
 
22
+ def save_cache_id
23
+ record.send "#{name}_cache_id=", cache_id if background?
24
+ end
25
+
22
26
  end
23
27
  end
24
28
  end
@@ -4,14 +4,12 @@ module Refile
4
4
  attr_reader :record, :attachment_name
5
5
  queue_as :refile
6
6
 
7
- def perform(record, attachment_name, metadata = nil)
7
+ def perform(record, attachment_name)
8
8
  @record = record
9
9
  @attachment_name = attachment_name
10
- @record.send "#{attachment_name}=", metadata if metadata
11
10
  return unless attachment_cached?
12
11
 
13
- file = attacher.get
14
- upload file
12
+ file = upload attacher.get
15
13
  cleanup_cache!
16
14
  update_record_attachment(file) if file
17
15
  yield if block_given?
@@ -37,8 +35,8 @@ module Refile
37
35
 
38
36
  def update_record_attachment(file)
39
37
  record._skip_refile_backgrounder = true
40
- record.send "#{attachment_name}_cache_id=", nil if respond_to? "#{attachment_name}_cache_id="
41
- record.send "#{attachment_name}_id=", nil if respond_to? "#{attachment_name}_id="
38
+ record.send "#{attachment_name}_cache_id=", nil if record.respond_to? "#{attachment_name}_cache_id="
39
+ record.send "#{attachment_name}_id=", file.id if record.respond_to? "#{attachment_name}_id="
42
40
  record.save
43
41
  end
44
42
 
@@ -1,5 +1,5 @@
1
1
  module Refile
2
2
  module Backgrounder
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: refile-backgrounder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Logan Serman