active_preview 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_preview/builder.rb +4 -5
- data/lib/active_preview/previewing.rb +1 -1
- data/lib/active_preview/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e596b87c4f53216ef8eb93e095da11fff8399f39f0d7eafa5b9aa1d08db2392
|
4
|
+
data.tar.gz: '049cbc159cbbcd5f11843704e2f68b9f84c29f41d0a9918a8fd63aebdb4ffcc1'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5e499eb31f2668b5f5ed2e9fb907e2f012cb8fd409ab0a367095e342468872c4bdf98f8dae2b3086876eeb4e5e37dfef379d237a04e728c909beab0b5a3790d
|
7
|
+
data.tar.gz: 6ec6c1ae20d3130bf15680f7a5473f88c59f88bd5a9730ce4d38a12d2c39543c17acc05b7dabf5b3d5d497c8c8c52b5512e77537eadb4d449affa02f8b0ca011
|
@@ -56,8 +56,8 @@ module ActivePreview
|
|
56
56
|
saved = model.send(association).order(:id)
|
57
57
|
child_klass = class_of_association(base_class: klass,
|
58
58
|
association: association)
|
59
|
-
|
60
|
-
|
59
|
+
BatchBuilder.build(klass: child_klass, saved_models: saved,
|
60
|
+
params: child_params, parent: preview)
|
61
61
|
end
|
62
62
|
|
63
63
|
def associate_parent
|
@@ -73,9 +73,8 @@ module ActivePreview
|
|
73
73
|
next if updated_associations.include?(a)
|
74
74
|
saved = [*model.send(a)]
|
75
75
|
next if saved.empty?
|
76
|
-
to_assign =
|
77
|
-
|
78
|
-
parent: preview)
|
76
|
+
to_assign = BatchBuilder.build(klass: saved.first.class,
|
77
|
+
saved_models: saved, parent: preview)
|
79
78
|
to_assign = to_assign.first if singular? a
|
80
79
|
preview.send("#{a}=", to_assign)
|
81
80
|
end
|