activerecord-bitemporal 7.0.0 → 7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9644dc51d17a2d86e13daa5982fab733cdab79fd1fda78fbe408412a90ccd337
4
- data.tar.gz: f535c500ce4f4f738e6c09102d89a449476407956460c1e5b80d211adb4b66c9
3
+ metadata.gz: d9808dd4b2762d30fff3034bdfb311d3a01980806785d68cff6b9552d7bd2925
4
+ data.tar.gz: 9e7031bd39bd9e0841b029ec0540a77b06d2f6bcc54b2e6c992155191e06c326
5
5
  SHA512:
6
- metadata.gz: d0f7ac0703dd57cd8a837f24adc5c0598cbb5b083a20266c20bd35ae4014a28ee6488ed48e3b30119f01b78c40c063deb7bcbe0f8c61280ef6b7a6bc60d5b3eb
7
- data.tar.gz: ad4faf9f2c337bcdcefd8f18a1dadaa191c327a82a5e7391d7b15f06b15bfeff631115466da7fb690062b35cf5174bf8ad991dd3041800abf6063c840bd241ac
6
+ metadata.gz: 961e34ee22fce1303baed4c54822e33f43f49c6203108d6d03c562fed2baf3e1cede22fc6d5c0e7994cb538c9fa26d949356b31440f96dfb10459651d3211819
7
+ data.tar.gz: 73315ea3d3bdc29541cfdadb65b1530f1d2d1036704c5f110a2cedf7da7d7349cb2690b33dfeb5411437fb360be7aea13111765430d3f66e47dd078f376c5672
data/CHANGELOG.md CHANGED
@@ -16,6 +16,61 @@
16
16
 
17
17
  ### Chores
18
18
 
19
+ ## 7.0.2
20
+
21
+ ### Breaking Changes
22
+
23
+ ### Added
24
+
25
+ ### Changed
26
+
27
+ ### Deprecated
28
+
29
+ ### Removed
30
+
31
+ ### Fixed
32
+
33
+ - [Fix Relation#load to return self instead of an Array #267](https://github.com/kufu/activerecord-bitemporal/pull/267)
34
+
35
+ ### Chores
36
+
37
+ - [Bump actions/checkout from 6.0.3 to 7.0.0 #266](https://github.com/kufu/activerecord-bitemporal/pull/266)
38
+ - [Bump ruby/setup-ruby from 1.313.0 to 1.314.0 #265](https://github.com/kufu/activerecord-bitemporal/pull/265)
39
+ - [Bump rubygems/release-gem from 1.3.0 to 1.4.0 #264](https://github.com/kufu/activerecord-bitemporal/pull/264)
40
+ - [Bump ruby/setup-ruby from 1.310.0 to 1.313.0 #263](https://github.com/kufu/activerecord-bitemporal/pull/263)
41
+ - [Bump rubygems/release-gem from 1.2.0 to 1.3.0 #262](https://github.com/kufu/activerecord-bitemporal/pull/262)
42
+ - [Bump actions/checkout from 6.0.2 to 6.0.3 #261](https://github.com/kufu/activerecord-bitemporal/pull/261)
43
+ - [Bump ruby/setup-ruby from 1.308.0 to 1.310.0 #260](https://github.com/kufu/activerecord-bitemporal/pull/260)
44
+ - [Bump ruby/setup-ruby from 1.306.0 to 1.308.0 #259](https://github.com/kufu/activerecord-bitemporal/pull/259)
45
+ - [Increase Dependabot cooldown to 7 days #258](https://github.com/kufu/activerecord-bitemporal/pull/258)
46
+ - [Bump ruby/setup-ruby from 1.305.0 to 1.306.0 #257](https://github.com/kufu/activerecord-bitemporal/pull/257)
47
+ - [Bump ruby/setup-ruby from 1.302.0 to 1.305.0 #256](https://github.com/kufu/activerecord-bitemporal/pull/256)
48
+ - [Bump ruby/setup-ruby from 1.301.0 to 1.302.0 #255](https://github.com/kufu/activerecord-bitemporal/pull/255)
49
+
50
+ ## 7.0.1
51
+
52
+ ### Breaking Changes
53
+
54
+ ### Added
55
+
56
+ ### Changed
57
+
58
+ ### Deprecated
59
+
60
+ ### Removed
61
+
62
+ ### Fixed
63
+
64
+ - [Use bitemporal_id as primary key for Rails 8+ excluding/without #252](https://github.com/kufu/activerecord-bitemporal/pull/252)
65
+ - [Use bitemporal_id as primary key for Rails 8+ AR::Batches #251](https://github.com/kufu/activerecord-bitemporal/pull/251)
66
+
67
+ ### Chores
68
+
69
+ - [Bump ruby/setup-ruby from 1.299.0 to 1.300.0 #253](https://github.com/kufu/activerecord-bitemporal/pull/253)
70
+ - [Bump rubygems/release-gem from 1.1.2 to 1.2.0 #250](https://github.com/kufu/activerecord-bitemporal/pull/250)
71
+ - [Bump ruby/setup-ruby from 1.295.0 to 1.299.0 #249](https://github.com/kufu/activerecord-bitemporal/pull/249)
72
+ - [Bump ruby/setup-ruby from 1.288.0 to 1.295.0 #248](https://github.com/kufu/activerecord-bitemporal/pull/248)
73
+
19
74
  ## 7.0.0
20
75
 
21
76
  ### Breaking Changes
@@ -270,9 +325,11 @@
270
325
  ## 4.1.0
271
326
 
272
327
  ### Added
328
+
273
329
  - [add label option #127](https://github.com/kufu/activerecord-bitemporal/pull/127)
274
330
 
275
331
  ### Changed
332
+
276
333
  - [Support for inverse_of of Rails 6.1 or higher #130](https://github.com/kufu/activerecord-bitemporal/pull/130)
277
334
 
278
335
  ### Deprecated
@@ -296,13 +353,13 @@
296
353
  ```rb
297
354
  class Employee < ActiveRecord::Base
298
355
  include ActiveRecord::Bitemporal
299
-
356
+
300
357
  after_bitemporal_create :log_create
301
358
  after_bitemporal_update :log_update
302
359
  after_bitemporal_destroy :log_destroy
303
-
360
+
304
361
  private
305
-
362
+
306
363
  def log_create
307
364
  puts "employee created"
308
365
  end
@@ -315,7 +372,7 @@
315
372
  puts "employee destroyed"
316
373
  end
317
374
  end
318
-
375
+
319
376
  employee = Employee.create!(...) # => "employee created"
320
377
  employee.update!(...) # => "employee updated"
321
378
  employee.destroy! # => "employee destroyed"
@@ -335,10 +392,10 @@
335
392
 
336
393
  ### Fixed
337
394
 
338
-
339
395
  ## 3.0.0
340
396
 
341
397
  ### Breaking Changes
398
+
342
399
  - [Assign updated bitemporal times to the receiver after update/destroy](https://github.com/kufu/activerecord-bitemporal/pull/118)
343
400
 
344
401
  ### Added
@@ -356,6 +413,7 @@
356
413
  ### Breaking Changes
357
414
 
358
415
  ### Added
416
+
359
417
  - [Add `InstanceMethods#swapped_id_previously_was`](https://github.com/kufu/activerecord-bitemporal/pull/114)
360
418
 
361
419
  ### Changed
@@ -371,6 +429,7 @@
371
429
  ### Breaking Changes
372
430
 
373
431
  ### Added
432
+
374
433
  - [replace postgres docker image](https://github.com/kufu/activerecord-bitemporal/pull/103)
375
434
  - [use Matrix Jobs in CircleCI](https://github.com/kufu/activerecord-bitemporal/pull/107)
376
435
  - [Add support changing swapped_id, when called #destroy](https://github.com/kufu/activerecord-bitemporal/pull/110)
@@ -388,6 +447,7 @@
388
447
  ### Breaking Changes
389
448
 
390
449
  ### Added
450
+
391
451
  - [Update valid_to after #update](https://github.com/kufu/activerecord-bitemporal/pull/105)
392
452
  - [Add GitHub Actions workflow to release to RubyGems.org](https://github.com/kufu/activerecord-bitemporal/pull/104)
393
453
  - [migrate Scheduled workflows in CircleCI](https://github.com/kufu/activerecord-bitemporal/pull/106)
@@ -403,11 +463,13 @@
403
463
  ## 2.0.0
404
464
 
405
465
  ### Breaking Changes
466
+
406
467
  - [[Proposal] Changed valid_in to exclude valid_from = to and valid_to = from. by osyo-manga · Pull Request #95](https://github.com/kufu/activerecord-bitemporal/pull/95)
407
468
 
408
469
  ### Added
409
470
 
410
471
  ### Changed
472
+
411
473
  - [[Proposal] Add range argument to .valid_allin. by Dooor · Pull Request #98](https://github.com/kufu/activerecord-bitemporal/pull/98)
412
474
 
413
475
  ### Deprecated
@@ -415,6 +477,7 @@
415
477
  ### Removed
416
478
 
417
479
  ### Fixed
480
+
418
481
  - [Fix JOIN query does not have valid_from / valid_to when using .or. by osyo-manga · Pull Request #99](https://github.com/kufu/activerecord-bitemporal/pull/99)
419
482
  - [Fix typo in README.md by Naoya9922 · Pull Request #101](https://github.com/kufu/activerecord-bitemporal/pull/101)
420
483
 
@@ -159,6 +159,19 @@ module ActiveRecord
159
159
 
160
160
  if ActiveRecord.version >= Gem::Version.new("8.0.0")
161
161
  use_bitemporal_id_as_primary_key :ids
162
+
163
+ # Ensure that AR::Batches
164
+ # (https://github.com/rails/rails/blob/v8.0.5/activerecord/lib/active_record/relation/batches.rb)
165
+ # works with `bitemporal_id` as the primary key in Rails 8+.
166
+ use_bitemporal_id_as_primary_key :find_each
167
+ use_bitemporal_id_as_primary_key :find_in_batches
168
+ use_bitemporal_id_as_primary_key :in_batches
169
+
170
+ # Ensure that `#excluding` and `#without`
171
+ # (https://github.com/rails/rails/blob/v8.0.5/activerecord/lib/active_record/relation/query_methods.rb#L1548-L1591)
172
+ # work with `bitemporal_id` as the primary key in Rails 8+.
173
+ use_bitemporal_id_as_primary_key :excluding
174
+ use_bitemporal_id_as_primary_key :without
162
175
  end
163
176
 
164
177
  def build_arel(*)
@@ -171,9 +184,9 @@ module ActiveRecord
171
184
  return super if loaded?
172
185
 
173
186
  # このタイミングで先読みしているアソシエーションが読み込まれるので時間を固定
174
- records = ActiveRecord::Bitemporal.with_bitemporal_option(**bitemporal_option) { super }
187
+ relation = ActiveRecord::Bitemporal.with_bitemporal_option(**bitemporal_option) { super }
175
188
 
176
- return records if records.empty?
189
+ return relation if relation.empty?
177
190
 
178
191
  valid_datetime_ = valid_datetime
179
192
  if ActiveRecord::Bitemporal.valid_datetime.nil? && (bitemporal_value[:with_valid_datetime].nil? || bitemporal_value[:with_valid_datetime] == :default_scope || valid_datetime_.nil?)
@@ -185,12 +198,14 @@ module ActiveRecord
185
198
  transaction_datetime_ = nil
186
199
  end
187
200
 
188
- return records if valid_datetime_.nil? && transaction_datetime_.nil?
201
+ return relation if valid_datetime_.nil? && transaction_datetime_.nil?
189
202
 
190
- records.each do |record|
203
+ relation.each do |record|
191
204
  record.send(:bitemporal_option_storage)[:valid_datetime] = valid_datetime_ if valid_datetime_
192
205
  record.send(:bitemporal_option_storage)[:transaction_datetime] = transaction_datetime_ if transaction_datetime_
193
206
  end
207
+
208
+ relation
194
209
  end
195
210
 
196
211
  # Use original primary_key for Active Record 8.0+ as much as possible
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module Bitemporal
5
- VERSION = "7.0.0"
5
+ VERSION = "7.0.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-bitemporal
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0
4
+ version: 7.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - SmartHR
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
78
  requirements: []
79
- rubygems_version: 4.0.7
79
+ rubygems_version: 4.0.15
80
80
  specification_version: 4
81
81
  summary: BiTemporal Data Model for ActiveRecord
82
82
  test_files: []