activerecord-insert_many 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/activerecord/insert_many.rb +8 -1
- data/lib/activerecord/insert_many/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d0c2ccf7d63fcc33b29d10baef77d505884c4f1
|
4
|
+
data.tar.gz: 29fd5e5ed70369751e34fee477240a61d6304041
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1872faa00486c75f45abe95407ba6433369e1232d7ffcf3cbd13293b787c5b5eb1c992f75b58888fd5c2aedff4fcaf3ab5031eb73a57c3a8ba69df4c2fe424d
|
7
|
+
data.tar.gz: 5faf2a908e26ebf9ab410db7a1e11c2f24d46793d41cfe657ff1210b1a19389eb4c53d4c697b56aad982e4545397edd756624252f80648a2ac36a952a9e26dee
|
@@ -23,7 +23,14 @@ module InsertManyStatement
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
primary_key_column = schema_cache.primary_keys(table_name)
|
27
|
+
returning = supports_returning? && primary_key_column.present? ? " RETURNING #{primary_key_column}" : ""
|
28
|
+
|
29
|
+
execute "INSERT INTO #{quote_table_name(table_name)} (#{key_list.join(', ')}) VALUES #{value_lists.map { |value| "(#{value.join(', ')})" }.join(",")}#{returning}", "Fixture Insert"
|
30
|
+
end
|
31
|
+
|
32
|
+
def supports_returning?
|
33
|
+
true
|
27
34
|
end
|
28
35
|
end
|
29
36
|
|
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
|
+
version: 0.2.0
|
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: 2015-
|
12
|
+
date: 2015-12-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
92
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.
|
93
|
+
rubygems_version: 2.4.8
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: Adds a method for bulk-inserted records using ActiveRecord
|