ika 1.0.6 → 1.0.7
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 +4 -4
- data/lib/ika/version.rb +1 -1
- data/lib/ika.rb +9 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3abad6f8697c03b9a6d50c631c0acf8b5d8fbf7a
|
4
|
+
data.tar.gz: 4e9571c823550eba97df6c48c40f9201efee97ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d57fd70a8b648df34e665a83066ff942d76149ed966889c267a81645cf55e99dbc639b9d8f926cc9dbbdd46824aa441a1eb68fd57640cd82eb6cfc9fd6a67728
|
7
|
+
data.tar.gz: 5a6b6045cff057685bb67c6b18015d4a6490db22bd22b191a8cabc29b739a0ba9efd5d54bce1ac219d0e70f35ced71bef338d3c70910fa6422921567f5f198f9
|
data/lib/ika/version.rb
CHANGED
data/lib/ika.rb
CHANGED
@@ -19,10 +19,10 @@ module Ika
|
|
19
19
|
end
|
20
20
|
|
21
21
|
ActiveRecord::Base.transaction do
|
22
|
-
sync = false
|
23
22
|
if options && options[:sync]
|
24
|
-
|
25
|
-
|
23
|
+
remove_target_ids = all.pluck(:id)
|
24
|
+
else
|
25
|
+
remove_target_ids = []
|
26
26
|
end
|
27
27
|
objects.each do |object|
|
28
28
|
record_exists = false
|
@@ -46,7 +46,7 @@ module Ika
|
|
46
46
|
md5 = Digest::MD5.file('public' + obj_url)
|
47
47
|
need_update = false if md5 == obj_md5 && record_exists && obj_name == Pathname(exist_object.try(key.to_sym).to_s).basename.to_s
|
48
48
|
end
|
49
|
-
if obj_url &&
|
49
|
+
if obj_url && need_update
|
50
50
|
object_params[key] = base64_conversion(obj_data, obj_name)
|
51
51
|
elsif obj_url.blank?
|
52
52
|
object_params[('remove_' + key).to_sym] = true
|
@@ -57,11 +57,14 @@ module Ika
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
if record_exists
|
60
|
-
|
60
|
+
exist_object.attributes = object_params
|
61
|
+
exist_object.save(validate: false)
|
61
62
|
else
|
62
|
-
|
63
|
+
new(object_params).save(validate: false)
|
63
64
|
end
|
65
|
+
remove_target_ids -= [object['id'].to_i]
|
64
66
|
end
|
67
|
+
where(id: remove_target_ids).destroy_all
|
65
68
|
end
|
66
69
|
end
|
67
70
|
|