insights_export 0.2.3 → 0.3.0
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/insights_export/export_models.rb +16 -7
- data/lib/insights_export/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: 4f5e81738b025c008f1d2497d2cc0dcb8d124c42
|
4
|
+
data.tar.gz: 0ba893949615be6531003e4d1904e3608552f034
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aacf1cf4ad557cb8b514d1fabbf99c81cc4ab56fdc235595502dc727a753d5b046b983473a01b52623820bf9b3ba925175e97f46d3fbe286088cc45280d806c4
|
7
|
+
data.tar.gz: 32db48cea7412fee70fd7ffda62d6976807d904477f544392da69843baef643e61633c5a2b1cc2309e3ede75cb171873386828cd0672ae8b44d4aec697c24a84
|
@@ -25,8 +25,20 @@ module InsightsExport
|
|
25
25
|
model_structure.each do |key, value|
|
26
26
|
if key == 'custom'
|
27
27
|
next
|
28
|
-
elsif key == 'columns' || key == '
|
28
|
+
elsif key == 'columns' || key == 'links'
|
29
29
|
output[model_name][key] ||= {}
|
30
|
+
|
31
|
+
# don't merge if 'links' uses the old { links: { incoming: {}, outgoing: {} } } structure.
|
32
|
+
# just replace then with the new { links: {} } structure
|
33
|
+
# TODO: remove this in the future
|
34
|
+
if key == 'links'
|
35
|
+
existing_hash_keys = output[model_name][key].keys.map(&:to_s).sort
|
36
|
+
if existing_hash_keys == %w(incoming outgoing)
|
37
|
+
output[model_name][key] = value
|
38
|
+
next
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
30
42
|
value.each do |value_key, value_value|
|
31
43
|
existing = output[model_name][key][value_key]
|
32
44
|
if existing != false
|
@@ -114,10 +126,7 @@ module InsightsExport
|
|
114
126
|
[key.to_sym, obj]
|
115
127
|
end.to_h,
|
116
128
|
custom: {},
|
117
|
-
links: {
|
118
|
-
incoming: {},
|
119
|
-
outgoing: {}
|
120
|
-
}
|
129
|
+
links: {}
|
121
130
|
}
|
122
131
|
|
123
132
|
model.reflections.each do |association_name, reflection|
|
@@ -132,7 +141,7 @@ module InsightsExport
|
|
132
141
|
# reflection.association_primary_key # id
|
133
142
|
|
134
143
|
model_structure[:columns].delete(reflection.foreign_key.to_sym)
|
135
|
-
model_structure[:links][
|
144
|
+
model_structure[:links][association_name] = {
|
136
145
|
model: reflection_class,
|
137
146
|
model_key: reflection.association_primary_key,
|
138
147
|
my_key: reflection.foreign_key
|
@@ -143,7 +152,7 @@ module InsightsExport
|
|
143
152
|
next
|
144
153
|
end
|
145
154
|
|
146
|
-
model_structure[:links][
|
155
|
+
model_structure[:links][association_name] = {
|
147
156
|
model: reflection_class,
|
148
157
|
model_key: reflection.foreign_key,
|
149
158
|
my_key: reflection.association_primary_key
|