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: 2820ff19963204787d8de587378d314ff507bacac18496e04042f6d289109b89
4
- data.tar.gz: 6dbb29d24697e3f1e08facc2dc91c243ab34bacbb1f59e1cb5a8e298bb6e5bf9
3
+ metadata.gz: 89ea73e438d44f7bd6d0b78b995057bc05254b19217d9fdf907c5938fee06e87
4
+ data.tar.gz: ca64781fe00476635ba2dc008c28557c6879d0512f01951077cdb1eafa2b8b27
5
5
  SHA512:
6
- metadata.gz: 12b2ce79daba44f89ff3cd55a398a305bd37a6be9fb92701f4798f23a09ebc4a47c396fc3d55cada3ec4e7cbafcefb100270b8dcf4904f4e1d75a6aeae13848f
7
- data.tar.gz: 8f5cf8c0dec25d8140f97e3c51bb1c9c0e2eabc3e953a6d6186876f5b36bc9581d250de65ac527e972b85f390edfeb99fb1e16656028a4642bb9d63ba6fec6da
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
- alias_method :instantiate_without_save_original, :instantiate
9
-
10
- def instantiate(attributes, column_types = {})
11
- record = instantiate_without_save_original(attributes, column_types)
12
- record.save_original
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
- def extract_record(row,column_names_with_alias)
167
- # if the :select option is set, only the selected field should be extracted
168
- # column_names_with_alias.inject({}){|record, (cn, an)| record[cn] = row[an] if row.has_key?(an); record}
169
- record = {}
170
- column_names_with_alias.each { |(cn, an)| record[cn] = row[an] if row.key?(an) }
171
- record
172
- end
173
- alias_method :instantiate_without_save_original, :instantiate
174
- def instantiate(row, aliases)
175
- instantiate_without_save_original(row, aliases)
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
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Bulkoperation
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'
4
4
  end
5
5
  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.0
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-06 00:00:00.000000000 Z
11
+ date: 2020-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord