activerecord-insert_many 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/activerecord-insert_many.gemspec +1 -1
- data/lib/activerecord/insert_many.rb +13 -1
- data/lib/activerecord/insert_many/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ef306012e1d1085adb51ce35165f5bce95ca34b105a07e649421a6c43cf81855
|
4
|
+
data.tar.gz: 02d8bd02f576089f0d2890153a5dd38bd75a3eff835a2b5071bf520390504da9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdaf6c45b028e37afc4be6f106ca821e36a1ef6d64e19be047caafc68051cdee550d4c6ffd87994dfdb26c2265d05f783b7cd8fe8aa0bb8bff7bbfca10e9cd8f
|
7
|
+
data.tar.gz: 60ac241384e8983ac3b429a5021b27af84f8eab59017f531f5dc7da0b04416aa6690b750c20820e2f717ae43a5d6a8bcf882947b08f6115c9b4177a2eb503c89
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.add_dependency "activerecord", ">= 5.0"
|
21
21
|
|
22
|
-
spec.add_development_dependency "bundler"
|
22
|
+
spec.add_development_dependency "bundler"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
24
|
spec.add_development_dependency "minitest-reporters"
|
25
25
|
spec.add_development_dependency "minitest-reporters-turn_reporter"
|
@@ -25,7 +25,7 @@ module ActiveRecord
|
|
25
25
|
|
26
26
|
result = execute sql, "Fixture Insert"
|
27
27
|
|
28
|
-
returning ? result
|
28
|
+
returning ? cast_result(result, table_name) : result
|
29
29
|
end
|
30
30
|
|
31
31
|
def insert_many_sql(fixtures, table_name, options={})
|
@@ -87,6 +87,18 @@ module ActiveRecord
|
|
87
87
|
sql
|
88
88
|
end
|
89
89
|
|
90
|
+
def cast_result(result, table_name)
|
91
|
+
types_by_column = result.fields.each_with_object({}) do |column_name, types|
|
92
|
+
types[column_name] = lookup_cast_type_from_column(columns(table_name).find { |column| column.name == column_name })
|
93
|
+
end
|
94
|
+
|
95
|
+
result.to_a.map { |row|
|
96
|
+
Hash[row.map { |column_name, value|
|
97
|
+
[ column_name, types_by_column[column_name].deserialize(value) ]
|
98
|
+
}]
|
99
|
+
}
|
100
|
+
end
|
101
|
+
|
90
102
|
def supports_on_conflict?
|
91
103
|
self.class.name == "ActiveRecord::ConnectionAdapters::PostgreSQLAdapter" && postgresql_version >= 90500
|
92
104
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-insert_many
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luke Booth
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-01-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -29,16 +29,16 @@ dependencies:
|
|
29
29
|
name: bundler
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
34
|
+
version: '0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- - "
|
39
|
+
- - ">="
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
41
|
+
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rake
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
174
|
version: '0'
|
175
175
|
requirements: []
|
176
176
|
rubyforge_project:
|
177
|
-
rubygems_version: 2.
|
177
|
+
rubygems_version: 2.7.3
|
178
178
|
signing_key:
|
179
179
|
specification_version: 4
|
180
180
|
summary: Adds a method for bulk-inserted records using ActiveRecord
|