en_masse 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/en_masse/refinements.rb +6 -4
- data/lib/en_masse/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: 7e933d95420678a4008ad9e6ca3bb1b228988053
|
4
|
+
data.tar.gz: 1665f92fbfe8f9d70e78e437c7723383123f3a61
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ffc90fcd2960bdfdcba366181ce0fdcd6bd49060e6cb90bb25720d113bede7cf0726878cf2756800d7f093ab491097e2b797901e7a36a792183305a02d5406b
|
7
|
+
data.tar.gz: 42cbc31e2ba23302fb2e34dfc12573b3618ff522c6fc044b38fdb62044839779e671279f877aea0b8f6f811df865ffbb96c5b3fa3e0ae1b98751bad32d6acf0a
|
data/lib/en_masse/refinements.rb
CHANGED
@@ -3,10 +3,12 @@ module EnMasse::Refinements
|
|
3
3
|
refine ::ActiveRecord::Base.singleton_class do
|
4
4
|
|
5
5
|
def insert_collection collection
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
if sequence_name.present?
|
7
|
+
ids = allocate_ids(collection.count)
|
8
|
+
collection.zip(ids).each do |record, id|
|
9
|
+
record.id = id
|
10
|
+
record.update_foreign_keys
|
11
|
+
end
|
10
12
|
end
|
11
13
|
values = collection.map{|record|
|
12
14
|
"(#{ record.values_for_insert(column_names).join(",") })"
|
data/lib/en_masse/version.rb
CHANGED