activerecord_bulkoperation 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89ea73e438d44f7bd6d0b78b995057bc05254b19217d9fdf907c5938fee06e87
|
4
|
+
data.tar.gz: ca64781fe00476635ba2dc008c28557c6879d0512f01951077cdb1eafa2b8b27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36859893c2c10556528b14302dc876defe26d694dc0ca3de6bd93fc1f8a620088d9c65751f2daf7395a66659ad0d0d0cf65c747fbc1fd729f06e3a4930abdf37
|
7
|
+
data.tar.gz: 665db719f1d4bb3cbcbb2910297d2c7bc62fe60baa3e0150d98fda4fa8510e09471e6ed6febc94d94f6a897269b46ac1191a252a8e32eb35c0e5936e62f555ce
|
@@ -1,18 +1,18 @@
|
|
1
1
|
require 'active_record/associations'
|
2
2
|
|
3
3
|
module ActiveRecord
|
4
|
-
|
5
4
|
module Persistence
|
6
5
|
module ClassMethods
|
6
|
+
|
7
|
+
alias_method :instantiate_without_save_original, :instantiate
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
record
|
14
|
-
end
|
9
|
+
def instantiate(attributes, column_types = {})
|
10
|
+
record = instantiate_without_save_original(attributes, column_types)
|
11
|
+
record.save_original
|
12
|
+
record
|
13
|
+
end
|
15
14
|
|
15
|
+
if Rails.gem_version >= Rails.gem_version('6.0')
|
16
16
|
alias_method :instantiate_instant_of_without_save_original, :instantiate_instance_of
|
17
17
|
|
18
18
|
def instantiate_instance_of(klass, attributes, column_types = {}, &block)
|
@@ -20,6 +20,7 @@ module ActiveRecord
|
|
20
20
|
record.save_original
|
21
21
|
record
|
22
22
|
end
|
23
|
+
end
|
23
24
|
end
|
24
25
|
end
|
25
26
|
|
@@ -163,16 +164,18 @@ module ActiveRecord
|
|
163
164
|
|
164
165
|
class JoinBase
|
165
166
|
attr_accessor :cached_record
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
167
|
+
if Rails.gem_version < Gem::Version.new('6.0')
|
168
|
+
def extract_record(row,column_names_with_alias)
|
169
|
+
# if the :select option is set, only the selected field should be extracted
|
170
|
+
# column_names_with_alias.inject({}){|record, (cn, an)| record[cn] = row[an] if row.has_key?(an); record}
|
171
|
+
record = {}
|
172
|
+
column_names_with_alias.each { |(cn, an)| record[cn] = row[an] if row.key?(an) }
|
173
|
+
record
|
174
|
+
end
|
175
|
+
alias_method :instantiate_without_save_original, :instantiate
|
176
|
+
def instantiate(row, aliases)
|
177
|
+
instantiate_without_save_original(row, aliases)
|
178
|
+
end
|
176
179
|
end
|
177
180
|
end
|
178
181
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord_bulkoperation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OSP
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|