activerecord-bitemporal 5.1.0 → 5.2.0

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: 682d7ade7951759a2237d6395aab4dccc06d5c5ea6d1820b20e1bd1301d2efc7
4
- data.tar.gz: a58bb4c8b01a5f7724ad367ab69e45a54f715b96a0d789e7690689798d0f0a88
3
+ metadata.gz: 690af251479740f03e0dafd504a9b906672e8860c6f8734b37b24f0d2c0c2b5d
4
+ data.tar.gz: 2b41e3d362d267e4b573911ec75a1b03de9c4259bf8312c6fae9759aae29bf34
5
5
  SHA512:
6
- metadata.gz: a1761e5e97fc83beac29d7e23edec2ab5bb4d02958b5a7600073b099ca800a6ad3ffa3f8f9bc423aafb412c4c11a2bb1cb03d09d4fd36b6d77e7dd02560a9493
7
- data.tar.gz: efc543c3eb6b2ab89d3556eb25f342983d8e5854ebbec77ee6cf853c01dd0ccd64945264c53f30bacb9d370a6083ba65b3791e88b26c0c5c4ecea4481ad66e0c
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,24 @@
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
+
3
22
  ## 5.1.0
4
23
 
5
24
  ### Added
@@ -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.1.0"
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.1.0
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-06-05 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
@@ -148,7 +148,6 @@ files:
148
148
  - gemfiles/rails_6.1.gemfile
149
149
  - gemfiles/rails_7.0.gemfile
150
150
  - gemfiles/rails_7.1.gemfile
151
- - gemfiles/rails_main.gemfile
152
151
  - lib/activerecord-bitemporal.rb
153
152
  - lib/activerecord-bitemporal/bitemporal.rb
154
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: "../"