duty_free 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/duty_free/column.rb +3 -1
- data/lib/duty_free/extensions.rb +4 -5
- data/lib/duty_free/version_number.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: aa22e01d02997c6b8bc562f19805d1f0f529e17793b0dd14282f43840ea2c86c
|
4
|
+
data.tar.gz: afa848b412ea1514e0afeaa36ba1093ccb1baecdd4384d225b07f76145e9457e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c60d6f2a72d34f4f99d3f9fea16b0ed2d1ff71b6088e4b6782a0b54decc15ef5ba45cef17f846079f4e5a55fd2f5dfcf25945b80351ff6006318b59fedcffd13
|
7
|
+
data.tar.gz: 6be734a732268268ef86768d88215e62b947c97326d823f3b631bab16de3f919877fedbf4184da1e1490904a752ed8e675bb173966cb9f2922860ae0b606020d
|
data/lib/duty_free/column.rb
CHANGED
@@ -28,7 +28,9 @@ module DutyFree
|
|
28
28
|
# sql_col = ::DutyFree::Util._prefix_join([table_name.compact.join('_'), name])
|
29
29
|
|
30
30
|
# Foolproof way, using the AREL mapping:
|
31
|
-
|
31
|
+
this_pre_prefix = pre_prefix.tr('.', '_')
|
32
|
+
this_pre_prefix << '_' unless pre_prefix.blank?
|
33
|
+
sql_col = ::DutyFree::Util._prefix_join([mapping["#{this_pre_prefix}#{prefix}_"], name])
|
32
34
|
sym = to_sym.to_s
|
33
35
|
sql_col == sym ? sql_col : "#{sql_col} AS #{sym}"
|
34
36
|
end
|
data/lib/duty_free/extensions.rb
CHANGED
@@ -46,7 +46,7 @@ module DutyFree
|
|
46
46
|
end
|
47
47
|
(is_required ? '* ' : '') + col
|
48
48
|
end
|
49
|
-
rows =
|
49
|
+
rows = [rows]
|
50
50
|
|
51
51
|
if is_with_data
|
52
52
|
# Automatically create a JOINs strategy and select list to get back all related rows
|
@@ -55,8 +55,7 @@ module DutyFree
|
|
55
55
|
|
56
56
|
# So we can properly create the SELECT list, create a mapping between our
|
57
57
|
# column alias prefixes and the aliases AREL creates.
|
58
|
-
|
59
|
-
arel_alias_names = ::DutyFree::Util._recurse_arel(relation.ast.cores.first.source)
|
58
|
+
arel_alias_names = ::DutyFree::Util._recurse_arel(relation.arel.ast.cores.first.source)
|
60
59
|
our_names = ::DutyFree::Util._recurse_arel(template_joins)
|
61
60
|
mapping = our_names.zip(arel_alias_names).to_h
|
62
61
|
|
@@ -87,7 +86,7 @@ module DutyFree
|
|
87
86
|
else
|
88
87
|
suggest_template(0, false, false)
|
89
88
|
end
|
90
|
-
puts "Chose #{import_template}"
|
89
|
+
# puts "Chose #{import_template}"
|
91
90
|
inserts = []
|
92
91
|
updates = []
|
93
92
|
counts = Hash.new { |h, k| h[k] = [] }
|
@@ -581,7 +580,7 @@ module DutyFree
|
|
581
580
|
klass.instance_variable_set(:@template_detail_columns, (template_detail_columns = nil))
|
582
581
|
end
|
583
582
|
unless template_detail_columns
|
584
|
-
puts "* Redoing *"
|
583
|
+
# puts "* Redoing *"
|
585
584
|
template_detail_columns = _recurse_def(klass, import_template[:all], import_template).first.map(&:to_sym)
|
586
585
|
klass.instance_variable_set(:@template_detail_columns, template_detail_columns)
|
587
586
|
end
|