activerecord-bixformer 0.4.17 → 0.4.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/activerecord-bixformer/model/csv/base.rb +14 -10
- data/lib/activerecord-bixformer/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: ae6888312a21e7d9354ae7c46e4b8fc9e87aa4c2
|
4
|
+
data.tar.gz: bb36394798a5fa42d748f1c2a50ca8ea8fe19fa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1995b2cb22b6f1569df73e0b284af26926e2425170a7be0e6db97b6efab7d20f21129960f2165ca09376c2853a5fd13878e8a320b1e9bf07e7b85abb37bb3044
|
7
|
+
data.tar.gz: a7d635b60db5b21c39640f455a380e07401ba241c078548793be9b7a780a0d5f5b82d76f1761269e68814cdf0662c87d5a1416f839ed50e5cde0cde85557b214
|
@@ -42,10 +42,6 @@ module ActiveRecord
|
|
42
42
|
private
|
43
43
|
|
44
44
|
def do_export(record_or_relation)
|
45
|
-
if record_or_relation.is_a?(::ActiveRecord::Relation)
|
46
|
-
record_or_relation = record_or_relation.where(@plan.pickup_value_for(self, :required_condition, {}))
|
47
|
-
end
|
48
|
-
|
49
45
|
values = run_bixformer_callback :export, type: :attribute do
|
50
46
|
# has_one でしか使わない想定なので record_or_relation は ActiveRecord::Base のはず
|
51
47
|
@attributes.map do |attr|
|
@@ -61,13 +57,21 @@ module ActiveRecord
|
|
61
57
|
|
62
58
|
run_bixformer_callback :export, type: :association do
|
63
59
|
@associations.inject(values) do |each_values, association|
|
64
|
-
association_value =
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
60
|
+
association_value =
|
61
|
+
if record_or_relation
|
62
|
+
run_bixformer_callback :export, on: association.name do
|
63
|
+
association_record_or_relation = record_or_relation.__send__(association.name)
|
64
|
+
|
65
|
+
if association_record_or_relation.is_a?(::ActiveRecord::Relation)
|
66
|
+
association_record_or_relation =
|
67
|
+
association_record_or_relation.where(@plan.pickup_value_for(association, :required_condition, {}))
|
68
|
+
end
|
69
|
+
|
70
|
+
association.export(association_record_or_relation)
|
71
|
+
end
|
72
|
+
end
|
69
73
|
|
70
|
-
each_values.merge(
|
74
|
+
each_values.merge(association_value || {})
|
71
75
|
end
|
72
76
|
end
|
73
77
|
end
|