synchronisable 1.0.1 → 1.0.2
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/synchronisable/error_handler.rb +8 -6
- data/lib/synchronisable/source.rb +1 -1
- data/lib/synchronisable/version.rb +1 -1
- 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: 3845145123b947ba744fd0312ae7302131b9aa02
|
4
|
+
data.tar.gz: 79c2c958faf936420e9ef0166e055fce4fd8d952
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c30615cf121cd45f57ac47f659357441ad185145545294165e61dceb4d67f1cfac0d54effd7fdfc9a2d93f709fdf8025b46e825e04a0d49788a798fd6c6e916
|
7
|
+
data.tar.gz: 51349d8e1a49c8e240680ba11d55fb98eec97f7c9b595c821ef0bfa0e3726f7b0cfda102e94fdb637f7851430e9a99eb0a32057f0448a31154c3ca72e8e581eb
|
@@ -21,14 +21,16 @@ module Synchronisable
|
|
21
21
|
# @return [Boolean] `true` if syncronization was completed
|
22
22
|
# without errors, `false` otherwise
|
23
23
|
def handle(source)
|
24
|
-
|
24
|
+
block = ->() {
|
25
25
|
yield
|
26
26
|
return true
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
}
|
28
|
+
|
29
|
+
source.parent ? block.() : ActiveRecord::Base.transaction(&block)
|
30
|
+
rescue Exception => e
|
31
|
+
@context.errors << e
|
32
|
+
log(e, source)
|
33
|
+
return false
|
32
34
|
end
|
33
35
|
|
34
36
|
private
|
@@ -9,7 +9,7 @@ module Synchronisable
|
|
9
9
|
attr_accessor :import_record
|
10
10
|
attr_reader :parent_associations, :child_associations
|
11
11
|
attr_reader :model, :remote_attrs, :remote_id,
|
12
|
-
:local_attrs, :import_ids
|
12
|
+
:local_attrs, :import_ids, :parent
|
13
13
|
|
14
14
|
def initialize(model, parent, remote_attrs)
|
15
15
|
@model, @parent, @synchronizer = model, parent, model.synchronizer
|