syncify 0.1.10 → 0.1.11
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/Gemfile.lock +1 -1
- data/README.md +6 -6
- data/lib/syncify/sync.rb +16 -16
- data/lib/syncify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 918d5747cc4a3d0201d61abf97f9df7958ee8df4
|
|
4
|
+
data.tar.gz: 7622eec95427ad3ef9ea72c121e80eb24e4cd372
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6c70d65b27921b1fc1a832ccfa73bd2f3608e054f465c090a2563b47bea27b552c71aef7caf60bd8aa7323146e2ba606a2977480d990093e39fa746d6f25a37f
|
|
7
|
+
data.tar.gz: c4b95f203fbf555decd87f64629235036c44bd3ce39e4c334e29cb7a0084886acb7f19b290907212f4ac66c6226a35b5a58be17c5c77661ad200c96656ce7f26
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -282,12 +282,12 @@ All hints have two methods:
|
|
|
282
282
|
|
|
283
283
|
You are most likely to use the `BasicHint` class. This class has a constructor that accepts the following arguments:
|
|
284
284
|
|
|
285
|
-
| Argument | Type
|
|
286
|
-
| ------------- |
|
|
287
|
-
| `from_class` | Class or array of classes
|
|
288
|
-
| `association` | Symbol or array of symbols | nil | If provided, the `association` argument declares that the hint applies to associations with the specified name or names.
|
|
289
|
-
| `to_class` | Class or array of classes
|
|
290
|
-
| `allowed` | Boolean (required)
|
|
285
|
+
| Argument | Type | Default | Description |
|
|
286
|
+
| ------------- | ----------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
287
|
+
| `from_class` | Class or array of classes | nil | If provided, the `from_class` argument declares that the hint applies to associations from the specified class or classes. |
|
|
288
|
+
| `association` | Symbol or array of symbols or regex | nil | If provided, the `association` argument declares that the hint applies to associations with the specified name or names or names matching the specified regular expression. |
|
|
289
|
+
| `to_class` | Class or array of classes | nil | If provided, the `to_class` argument declares that the hint applies to associations to the specified class or classes. |
|
|
290
|
+
| `allowed` | Boolean (required) | | This argument indicates that if the hint is applicable to a particular association that it is or is not allowed, meaning that the `IdentifyAssociations` class will or will not ignore it. |
|
|
291
291
|
|
|
292
292
|
Hints can be specified for use by `IdentifyAssociations` like so:
|
|
293
293
|
|
data/lib/syncify/sync.rb
CHANGED
|
@@ -67,12 +67,12 @@ module Syncify
|
|
|
67
67
|
polymorphic_associations = associations.select(&method(:includes_polymorphic_association))
|
|
68
68
|
|
|
69
69
|
standard_associations.each do |association|
|
|
70
|
-
begin
|
|
71
|
-
|
|
72
|
-
rescue StandardError => e
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
end
|
|
70
|
+
# begin
|
|
71
|
+
traverse_associations(root.class.eager_load(association).find(root.id), association)
|
|
72
|
+
# rescue StandardError => e
|
|
73
|
+
# binding.pry
|
|
74
|
+
# x = 1231231231
|
|
75
|
+
# end
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
identify_polymorphic_associated_records(root, polymorphic_associations)
|
|
@@ -159,17 +159,17 @@ module Syncify
|
|
|
159
159
|
|
|
160
160
|
has_and_belongs_to_many_associations.each do |record, associations|
|
|
161
161
|
associations.each do |association, associated_records|
|
|
162
|
-
begin
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
end
|
|
167
|
-
local_record.__send__(association) << local_associated_records
|
|
168
|
-
local_record.save
|
|
169
|
-
rescue StandardError => e
|
|
170
|
-
binding.pry
|
|
171
|
-
x = 123
|
|
162
|
+
# begin
|
|
163
|
+
local_record = record.class.find(record.id)
|
|
164
|
+
local_associated_records = associated_records.map do |associated_record|
|
|
165
|
+
associated_record.class.find(associated_record.id)
|
|
172
166
|
end
|
|
167
|
+
local_record.__send__(association) << local_associated_records
|
|
168
|
+
local_record.save
|
|
169
|
+
# rescue StandardError => e
|
|
170
|
+
# binding.pry
|
|
171
|
+
# x = 123
|
|
172
|
+
# end
|
|
173
173
|
end
|
|
174
174
|
end
|
|
175
175
|
end
|
data/lib/syncify/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: syncify
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Doug Hughes
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-10-
|
|
11
|
+
date: 2019-10-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|