activerecord-bitemporal 5.0.1 → 5.2.0

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: f0e6cafe3d918cd4bdf47c2610eaf3760cfcedbec0365a7675ef99790a05baaf
4
- data.tar.gz: 79b7823949b22cbcacdfb75b561c70808135ebd3dc1c6a5ff0ef8152c75b8d79
3
+ metadata.gz: 690af251479740f03e0dafd504a9b906672e8860c6f8734b37b24f0d2c0c2b5d
4
+ data.tar.gz: 2b41e3d362d267e4b573911ec75a1b03de9c4259bf8312c6fae9759aae29bf34
5
5
  SHA512:
6
- metadata.gz: 4331c2b17a26dfea76b5c1c85a6a0feac925a1c0b7d634fa734e35e5f7732e0d49d04172ae4bf6af5ae62b213481bd09da7807312f241578e72f2a9ee952f640
7
- data.tar.gz: 98ffa072e196a6af9b61ef01ee5e7d8e3ef83a94abd8f666738831783b35bb16551fd0bd1d561f76a6a55aa522d4609274ec3e6a6a78d311b7c76e53c860b1c4
6
+ metadata.gz: d86c42c61e77843ef9a76e45868d71722f08e8af28f6c1747f2d4ea55ecd1bf5d5731d3e4b41ad82827c59e0f8e21f3b9ab714a7dc2a442c387c17c97858c8bc
7
+ data.tar.gz: e53538e79ab1b48563e804080a23f8e8aa6f67f6fa71a54880fa7c93696a9e8778fc5248937ea653cefe72f8cb215e84aec223559f1436506354f65ade735f8d
data/.circleci/config.yml CHANGED
@@ -33,7 +33,6 @@ workflows:
33
33
  - rails_6.1
34
34
  - rails_7.0
35
35
  - rails_7.1
36
- - rails_main
37
36
  exclude:
38
37
  - ruby-version: '3.2'
39
38
  gemfile: rails_6.1
data/Appraisals CHANGED
@@ -1,9 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- appraise "rails-main" do
4
- gem "rails", git: 'https://github.com/rails/rails.git', branch: "main"
5
- end
6
-
7
3
  appraise "rails-6.1" do
8
4
  gem "rails", "~> 6.1.0"
9
5
  end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.2.0
4
+
5
+ ### Added
6
+
7
+ ### Changed
8
+
9
+ ### Deprecated
10
+
11
+ ### Removed
12
+
13
+ ### Fixed
14
+
15
+ - [Delegate CollectionProxy#bitemporal_value to Relation #168](https://github.com/kufu/activerecord-bitemporal/pull/168)
16
+ - [Fix unintended valid_datetime set when `CollectionProxy#load` #169](https://github.com/kufu/activerecord-bitemporal/pull/169)
17
+
18
+ ### Chores
19
+
20
+ - [Do not run CI against rails_main #166](https://github.com/kufu/activerecord-bitemporal/pull/166)
21
+
22
+ ## 5.1.0
23
+
24
+ ### Added
25
+
26
+ ### Changed
27
+
28
+ ### Deprecated
29
+
30
+ ### Removed
31
+
32
+ ### Fixed
33
+
34
+ - [Remove `joinable: false` #156](https://github.com/kufu/activerecord-bitemporal/pull/156)
35
+
36
+ ### Chores
37
+
38
+ - [Remove database_cleaner #162](https://github.com/kufu/activerecord-bitemporal/pull/162)
39
+
3
40
  ## 5.0.1
4
41
 
5
42
  - [Fix a typo #157](https://github.com/kufu/activerecord-bitemporal/pull/157)
@@ -31,6 +31,5 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency "pg"
32
32
  spec.add_development_dependency "pry"
33
33
  spec.add_development_dependency "pry-byebug"
34
- spec.add_development_dependency "database_cleaner"
35
34
  spec.add_development_dependency "timecop"
36
35
  end
@@ -359,7 +359,7 @@ module ActiveRecord
359
359
  def destroy(force_delete: false, operated_at: nil)
360
360
  return super() if force_delete
361
361
 
362
- ActiveRecord::Base.transaction(requires_new: true, joinable: false) do
362
+ ActiveRecord::Base.transaction(requires_new: true) do
363
363
  @destroyed = false
364
364
  _run_destroy_callbacks {
365
365
  operated_at ||= Time.current
@@ -141,6 +141,22 @@ module ActiveRecord::Bitemporal
141
141
  end
142
142
  end
143
143
 
144
+ module CollectionProxy
145
+ # Delegate to ActiveRecord::Bitemporal::Relation
146
+ # @see https://github.com/rails/rails/blob/v7.1.3.4/activerecord/lib/active_record/associations/collection_proxy.rb#L1115-L1124
147
+ #
148
+ # In order to update the CollectionProxy state, `load` needs to be excluded.
149
+ # The reason for using `@association` instead of delegating this method is to preserve state such as `loaded`.
150
+ # @see https://github.com/rails/rails/blob/v7.1.3.4/activerecord/lib/active_record/associations/collection_proxy.rb#L44
151
+ #
152
+ # There is no need to delegate to `scope` as `ActiveRecord::Bitemporal::Relation::Finder`'s methods are delegated
153
+ # by `ActiveRecord::Delegation`. This is not a problem because `scoping` used in this is delegated to `scope`.
154
+ # @see https://github.com/rails/rails/blob/v7.1.3.4/activerecord/lib/active_record/relation/delegation.rb#L117
155
+ delegate :bitemporal_value, :bitemporal_value=, :valid_datetime, :valid_date,
156
+ :transaction_datetime, :bitemporal_option, :bitemporal_option_merge!,
157
+ :build_arel, :primary_key, to: :scope
158
+ end
159
+
144
160
  module Scope
145
161
  extend ActiveSupport::Concern
146
162
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module Bitemporal
5
- VERSION = "5.0.1"
5
+ VERSION = "5.2.0"
6
6
  end
7
7
  end
@@ -29,7 +29,6 @@ module ActiveRecord::Bitemporal::Bitemporalize
29
29
  def prepend_relation_delegate_class(mod)
30
30
  relation_delegate_class(ActiveRecord::Relation).prepend mod
31
31
  relation_delegate_class(ActiveRecord::AssociationRelation).prepend mod
32
- relation_delegate_class(ActiveRecord::Associations::CollectionProxy).prepend mod
33
32
  end
34
33
  end
35
34
  end
@@ -58,6 +57,7 @@ module ActiveRecord::Bitemporal::Bitemporalize
58
57
  def inherited(klass)
59
58
  super
60
59
  klass.prepend_relation_delegate_class ActiveRecord::Bitemporal::Relation
60
+ klass.relation_delegate_class(ActiveRecord::Associations::CollectionProxy).prepend ActiveRecord::Bitemporal::CollectionProxy
61
61
  if relation_delegate_class(ActiveRecord::Relation).ancestors.include? ActiveRecord::Bitemporal::Relation::MergeWithExceptBitemporalDefaultScope
62
62
  klass.relation_delegate_class(ActiveRecord::Relation).prepend ActiveRecord::Bitemporal::Relation::MergeWithExceptBitemporalDefaultScope
63
63
  end
@@ -169,6 +169,7 @@ module ActiveRecord::Bitemporal::Bitemporalize
169
169
  validates bitemporal_id_key, uniqueness: true, allow_nil: true, strict: enable_strict_by_validates_bitemporal_id
170
170
 
171
171
  prepend_relation_delegate_class ActiveRecord::Bitemporal::Relation
172
+ relation_delegate_class(ActiveRecord::Associations::CollectionProxy).prepend ActiveRecord::Bitemporal::CollectionProxy
172
173
  end
173
174
  end
174
175
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-bitemporal
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SmartHR
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-05-10 00:00:00.000000000 Z
11
+ date: 2024-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -108,20 +108,6 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: database_cleaner
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: timecop
127
113
  requirement: !ruby/object:Gem::Requirement
@@ -162,7 +148,6 @@ files:
162
148
  - gemfiles/rails_6.1.gemfile
163
149
  - gemfiles/rails_7.0.gemfile
164
150
  - gemfiles/rails_7.1.gemfile
165
- - gemfiles/rails_main.gemfile
166
151
  - lib/activerecord-bitemporal.rb
167
152
  - lib/activerecord-bitemporal/bitemporal.rb
168
153
  - lib/activerecord-bitemporal/callbacks.rb
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "appraisal"
6
- gem "rails", git: "https://github.com/rails/rails.git", branch: "main"
7
-
8
- gemspec path: "../"