activerecord-bitemporal 4.0.0 → 4.1.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: 4be4f1dd46241e22de6ea7acf687531b3313fdd83f2deab6e9a7d249cc6b5853
4
- data.tar.gz: 70b235bbe03555fa5db6ba0309af3147d2fb4f80708a13ac421944f6c4603a0b
3
+ metadata.gz: '09a592f0b1e43e737bd1fdbc8a88f025af734bf3c0d42c4fa2297dbaa72a68e5'
4
+ data.tar.gz: b591ee586a0d5fc3f109444787f86bc5c399f22d33c44d84d80bde6f91b141ac
5
5
  SHA512:
6
- metadata.gz: 8817c135d2f0ea3ec5d8979f0360ac5772ad32ff244d5ebf65b6111954452e41ada1b9466669313775356cf3838fc522289344125392c9a4700c869c6705c0fd
7
- data.tar.gz: 28a09497a4e6d7c085a6e44b6f4262a6fa2d6ac0f79d499b1bd6d6b946bacaaf78a14ab1f2389d9d96a719fee4168c0374ddad5b4994b34e07f8738c6462ba0f
6
+ metadata.gz: b0d9d4f5dd752200b2e803bca72b123ed067165bd61092755fb091b10eb35fd58b82617f7957d48f738b8f9ec09c480d8338553c3b33098202056d2d20e94d09
7
+ data.tar.gz: d90e6bbb55b783bc75f650c00c4bbaf226b4d5ba67c86e004bfecbe75224031c0a0ad69c95955741c0b560bdc85fc2a4f3945d07885d0b128ecbf0416f003569
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.1.0
4
+
5
+ ### Added
6
+ - [add label option #127](https://github.com/kufu/activerecord-bitemporal/pull/127)
7
+
8
+ ### Changed
9
+ - [Support for inverse_of of Rails 6.1 or higher #130](https://github.com/kufu/activerecord-bitemporal/pull/130)
10
+
11
+ ### Deprecated
12
+
13
+ ### Removed
14
+
15
+ ### Fixed
16
+
3
17
  ## 4.0.0
4
18
 
5
19
  ### Breaking Changed
@@ -79,6 +79,18 @@ module ActiveRecord::Bitemporal
79
79
  def bi_temporal_model?
80
80
  owner.class.bi_temporal_model? && klass&.bi_temporal_model?
81
81
  end
82
+
83
+ def matches_foreign_key?(record)
84
+ return super unless owner.class.bi_temporal_model?
85
+
86
+ begin
87
+ original_owner_id = owner.id
88
+ owner.id = owner.read_attribute(owner.class.bitemporal_id_key)
89
+ super
90
+ ensure
91
+ owner.id = original_owner_id
92
+ end
93
+ end
82
94
  end
83
95
 
84
96
  module ThroughAssociation
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module Bitemporal
5
- VERSION = "4.0.0"
5
+ VERSION = "4.1.0"
6
6
  end
7
7
  end
@@ -91,8 +91,17 @@ module ActiveRecord::Bitemporal
91
91
  end
92
92
  end
93
93
  end
94
-
95
- "#{headers.to_s}\n#{body.to_s}"
94
+
95
+ transaction_label = 'transaction_datetime'
96
+ right_margin = time_length + 1 - transaction_label.size
97
+
98
+ label = if right_margin >= 0
99
+ "#{transaction_label + ' ' * right_margin}| valid_datetime"
100
+ else
101
+ "#{transaction_label[0...right_margin]}| valid_datetime"
102
+ end
103
+
104
+ "#{label}\n#{headers.to_s}\n#{body.to_s}"
96
105
  end
97
106
 
98
107
  # Compute a dictionary of where each time should be plotted.
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: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SmartHR
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-01 00:00:00.000000000 Z
11
+ date: 2023-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -189,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
189
  - !ruby/object:Gem::Version
190
190
  version: '0'
191
191
  requirements: []
192
- rubygems_version: 3.1.6
192
+ rubygems_version: 3.3.26
193
193
  signing_key:
194
194
  specification_version: 4
195
195
  summary: BiTemporal Data Model for ActiveRecord