temporal_tables 0.6.10 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +3 -1
  4. data/README.md +1 -1
  5. data/gemfiles/Gemfile.5.0.mysql.lock +3 -3
  6. data/gemfiles/Gemfile.5.0.pg.lock +3 -3
  7. data/gemfiles/Gemfile.5.1.mysql.lock +3 -3
  8. data/gemfiles/Gemfile.5.1.pg.lock +3 -3
  9. data/gemfiles/Gemfile.5.2.mysql.lock +3 -3
  10. data/gemfiles/Gemfile.5.2.pg.lock +3 -3
  11. data/gemfiles/Gemfile.6.0.mysql +16 -0
  12. data/gemfiles/Gemfile.6.0.mysql.lock +171 -0
  13. data/gemfiles/Gemfile.6.0.pg +16 -0
  14. data/gemfiles/Gemfile.6.0.pg.lock +171 -0
  15. data/lib/temporal_tables/arel_table.rb +19 -0
  16. data/lib/temporal_tables/association_extensions.rb +16 -16
  17. data/lib/temporal_tables/connection_adapters/mysql_adapter.rb +54 -54
  18. data/lib/temporal_tables/connection_adapters/postgresql_adapter.rb +64 -64
  19. data/lib/temporal_tables/history_hook.rb +43 -43
  20. data/lib/temporal_tables/join_extensions.rb +14 -14
  21. data/lib/temporal_tables/preloader_extensions.rb +14 -14
  22. data/lib/temporal_tables/reflection_extensions.rb +14 -14
  23. data/lib/temporal_tables/relation_extensions.rb +79 -79
  24. data/lib/temporal_tables/temporal_adapter.rb +181 -174
  25. data/lib/temporal_tables/temporal_class.rb +101 -101
  26. data/lib/temporal_tables/version.rb +1 -1
  27. data/lib/temporal_tables/whodunnit.rb +16 -16
  28. data/lib/temporal_tables.rb +46 -45
  29. data/spec/basic_history_spec.rb +138 -138
  30. data/spec/internal/app/models/flying_machine.rb +1 -1
  31. data/spec/internal/app/models/person.rb +3 -3
  32. data/spec/internal/db/schema.rb +17 -17
  33. data/spec/spec_helper.rb +4 -4
  34. data/spec/support/database.rb +7 -7
  35. data/temporal_tables.gemspec +15 -15
  36. metadata +16 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2c3cea031083df1bc590ff4e74869b1574b4a312145692efe11c6cd616dfc31
4
- data.tar.gz: 928adaf78e5bfb5dfbfb57e942755bba2609be2a82d482544799ac4db25cabd4
3
+ metadata.gz: 55f7a578768440a6fdc770e81ad15f2a8e29797e399325ddd3fc9e2424f65b11
4
+ data.tar.gz: ad7a2f9d0a3a78111484ad178501d3d35c965e11dbdf2954641c384291142c5a
5
5
  SHA512:
6
- metadata.gz: 5312c5a461f6ae0546a6173b8618e21649bc76dec62ece50245135da97a19caf570323da027556cb5517045bdd3c8340a201bcfc582c0d0d5d52995d20079ea2
7
- data.tar.gz: fe4b025bd68e8ea38c2d69eb942949cbb3a015ec9f20e9409d67d639d51cd2fadd5cb84d5fbd81c7ff0bdbddd1722fcc410970b0056f5f6d71539a119f83539e
6
+ metadata.gz: 3185691e58dc83ed24bad103ded115f8ac1d49c4f2f2ac68229c7157493ae1a31a8c37fbd5354922a74c172b8516d797a70339b62d5d4004d7c2ca800cbe5051
7
+ data.tar.gz: 00372454aa452460c4e4ad66ab62202c549ba729823bed275bafc9c7f5c40ee6fdf9d6769d8439ca5273c5a9f20742f02d7049663853e9e89b2d913bd6712645
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.4.3
1
+ 2.5.4
data/.travis.yml CHANGED
@@ -1,11 +1,13 @@
1
1
  rvm:
2
- - 2.4.3
2
+ - 2.5.4
3
3
 
4
4
  gemfile:
5
5
  - gemfiles/Gemfile.5.0.pg
6
6
  - gemfiles/Gemfile.5.1.pg
7
7
  - gemfiles/Gemfile.5.2.pg
8
+ - gemfiles/Gemfile.6.0.pg
8
9
 
9
10
  - gemfiles/Gemfile.5.0.mysql
10
11
  - gemfiles/Gemfile.5.1.mysql
11
12
  - gemfiles/Gemfile.5.2.mysql
13
+ - gemfiles/Gemfile.6.0.mysql
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Easily recall what your data looked like at any point in the past! TemporalTables sets up and maintains history tables to track all temporal changes to to your data.
4
4
 
5
- Currently tested on Ruby 2.4, Rails 5.2, Postgres 10.3, MySQL 8.0.11
5
+ Currently tested on Ruby 2.5.4, Rails 5.0 - 6.0, Postgres 11.3, MySQL 8.0.13
6
6
 
7
7
  ## Installation
8
8
 
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- temporal_tables (0.6.10)
5
- rails (~> 5.0)
4
+ temporal_tables (0.7.0)
5
+ rails (>= 5.0, <= 6.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -144,4 +144,4 @@ DEPENDENCIES
144
144
  temporal_tables!
145
145
 
146
146
  BUNDLED WITH
147
- 1.16.6
147
+ 1.17.3
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- temporal_tables (0.6.10)
5
- rails (~> 5.0)
4
+ temporal_tables (0.7.0)
5
+ rails (>= 5.0, <= 6.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -144,4 +144,4 @@ DEPENDENCIES
144
144
  temporal_tables!
145
145
 
146
146
  BUNDLED WITH
147
- 1.16.6
147
+ 1.17.3
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- temporal_tables (0.6.10)
5
- rails (~> 5.0)
4
+ temporal_tables (0.7.0)
5
+ rails (>= 5.0, <= 6.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -144,4 +144,4 @@ DEPENDENCIES
144
144
  temporal_tables!
145
145
 
146
146
  BUNDLED WITH
147
- 1.16.6
147
+ 1.17.3
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- temporal_tables (0.6.10)
5
- rails (~> 5.0)
4
+ temporal_tables (0.7.0)
5
+ rails (>= 5.0, <= 6.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -144,4 +144,4 @@ DEPENDENCIES
144
144
  temporal_tables!
145
145
 
146
146
  BUNDLED WITH
147
- 1.16.6
147
+ 1.17.3
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- temporal_tables (0.6.10)
5
- rails (~> 5.0)
4
+ temporal_tables (0.7.0)
5
+ rails (>= 5.0, <= 6.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -152,4 +152,4 @@ DEPENDENCIES
152
152
  temporal_tables!
153
153
 
154
154
  BUNDLED WITH
155
- 1.16.6
155
+ 1.17.3
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- temporal_tables (0.6.10)
5
- rails (~> 5.0)
4
+ temporal_tables (0.7.0)
5
+ rails (>= 5.0, <= 6.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -152,4 +152,4 @@ DEPENDENCIES
152
152
  temporal_tables!
153
153
 
154
154
  BUNDLED WITH
155
- 1.16.6
155
+ 1.17.3
@@ -0,0 +1,16 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Runtime dependencies
4
+ gem 'rails', '~> 6.0.0'
5
+ gem 'mysql2'
6
+
7
+ # Development dependencies
8
+ gem 'rspec', '~> 3.4'
9
+ gem 'rake'
10
+ gem 'byebug'
11
+ gem 'database_cleaner'
12
+ gem 'combustion'
13
+ gem 'gemika'
14
+
15
+ # Gem under test
16
+ gem 'temporal_tables', :path => '..'
@@ -0,0 +1,171 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ temporal_tables (0.7.0)
5
+ rails (>= 5.0, <= 6.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (6.0.0)
11
+ actionpack (= 6.0.0)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ actionmailbox (6.0.0)
15
+ actionpack (= 6.0.0)
16
+ activejob (= 6.0.0)
17
+ activerecord (= 6.0.0)
18
+ activestorage (= 6.0.0)
19
+ activesupport (= 6.0.0)
20
+ mail (>= 2.7.1)
21
+ actionmailer (6.0.0)
22
+ actionpack (= 6.0.0)
23
+ actionview (= 6.0.0)
24
+ activejob (= 6.0.0)
25
+ mail (~> 2.5, >= 2.5.4)
26
+ rails-dom-testing (~> 2.0)
27
+ actionpack (6.0.0)
28
+ actionview (= 6.0.0)
29
+ activesupport (= 6.0.0)
30
+ rack (~> 2.0)
31
+ rack-test (>= 0.6.3)
32
+ rails-dom-testing (~> 2.0)
33
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
34
+ actiontext (6.0.0)
35
+ actionpack (= 6.0.0)
36
+ activerecord (= 6.0.0)
37
+ activestorage (= 6.0.0)
38
+ activesupport (= 6.0.0)
39
+ nokogiri (>= 1.8.5)
40
+ actionview (6.0.0)
41
+ activesupport (= 6.0.0)
42
+ builder (~> 3.1)
43
+ erubi (~> 1.4)
44
+ rails-dom-testing (~> 2.0)
45
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
46
+ activejob (6.0.0)
47
+ activesupport (= 6.0.0)
48
+ globalid (>= 0.3.6)
49
+ activemodel (6.0.0)
50
+ activesupport (= 6.0.0)
51
+ activerecord (6.0.0)
52
+ activemodel (= 6.0.0)
53
+ activesupport (= 6.0.0)
54
+ activestorage (6.0.0)
55
+ actionpack (= 6.0.0)
56
+ activejob (= 6.0.0)
57
+ activerecord (= 6.0.0)
58
+ marcel (~> 0.3.1)
59
+ activesupport (6.0.0)
60
+ concurrent-ruby (~> 1.0, >= 1.0.2)
61
+ i18n (>= 0.7, < 2)
62
+ minitest (~> 5.1)
63
+ tzinfo (~> 1.1)
64
+ zeitwerk (~> 2.1, >= 2.1.8)
65
+ builder (3.2.3)
66
+ byebug (11.0.1)
67
+ combustion (1.1.1)
68
+ activesupport (>= 3.0.0)
69
+ railties (>= 3.0.0)
70
+ thor (>= 0.14.6)
71
+ concurrent-ruby (1.1.5)
72
+ crass (1.0.4)
73
+ database_cleaner (1.7.0)
74
+ diff-lcs (1.3)
75
+ erubi (1.8.0)
76
+ gemika (0.4.0)
77
+ globalid (0.4.2)
78
+ activesupport (>= 4.2.0)
79
+ i18n (1.6.0)
80
+ concurrent-ruby (~> 1.0)
81
+ loofah (2.2.3)
82
+ crass (~> 1.0.2)
83
+ nokogiri (>= 1.5.9)
84
+ mail (2.7.1)
85
+ mini_mime (>= 0.1.1)
86
+ marcel (0.3.3)
87
+ mimemagic (~> 0.3.2)
88
+ method_source (0.9.2)
89
+ mimemagic (0.3.3)
90
+ mini_mime (1.0.2)
91
+ mini_portile2 (2.4.0)
92
+ minitest (5.11.3)
93
+ mysql2 (0.5.2)
94
+ nio4r (2.5.1)
95
+ nokogiri (1.10.4)
96
+ mini_portile2 (~> 2.4.0)
97
+ rack (2.0.7)
98
+ rack-test (1.1.0)
99
+ rack (>= 1.0, < 3)
100
+ rails (6.0.0)
101
+ actioncable (= 6.0.0)
102
+ actionmailbox (= 6.0.0)
103
+ actionmailer (= 6.0.0)
104
+ actionpack (= 6.0.0)
105
+ actiontext (= 6.0.0)
106
+ actionview (= 6.0.0)
107
+ activejob (= 6.0.0)
108
+ activemodel (= 6.0.0)
109
+ activerecord (= 6.0.0)
110
+ activestorage (= 6.0.0)
111
+ activesupport (= 6.0.0)
112
+ bundler (>= 1.3.0)
113
+ railties (= 6.0.0)
114
+ sprockets-rails (>= 2.0.0)
115
+ rails-dom-testing (2.0.3)
116
+ activesupport (>= 4.2.0)
117
+ nokogiri (>= 1.6)
118
+ rails-html-sanitizer (1.2.0)
119
+ loofah (~> 2.2, >= 2.2.2)
120
+ railties (6.0.0)
121
+ actionpack (= 6.0.0)
122
+ activesupport (= 6.0.0)
123
+ method_source
124
+ rake (>= 0.8.7)
125
+ thor (>= 0.20.3, < 2.0)
126
+ rake (12.3.3)
127
+ rspec (3.8.0)
128
+ rspec-core (~> 3.8.0)
129
+ rspec-expectations (~> 3.8.0)
130
+ rspec-mocks (~> 3.8.0)
131
+ rspec-core (3.8.2)
132
+ rspec-support (~> 3.8.0)
133
+ rspec-expectations (3.8.4)
134
+ diff-lcs (>= 1.2.0, < 2.0)
135
+ rspec-support (~> 3.8.0)
136
+ rspec-mocks (3.8.1)
137
+ diff-lcs (>= 1.2.0, < 2.0)
138
+ rspec-support (~> 3.8.0)
139
+ rspec-support (3.8.2)
140
+ sprockets (3.7.2)
141
+ concurrent-ruby (~> 1.0)
142
+ rack (> 1, < 3)
143
+ sprockets-rails (3.2.1)
144
+ actionpack (>= 4.0)
145
+ activesupport (>= 4.0)
146
+ sprockets (>= 3.0.0)
147
+ thor (0.20.3)
148
+ thread_safe (0.3.6)
149
+ tzinfo (1.2.5)
150
+ thread_safe (~> 0.1)
151
+ websocket-driver (0.7.1)
152
+ websocket-extensions (>= 0.1.0)
153
+ websocket-extensions (0.1.4)
154
+ zeitwerk (2.1.9)
155
+
156
+ PLATFORMS
157
+ ruby
158
+
159
+ DEPENDENCIES
160
+ byebug
161
+ combustion
162
+ database_cleaner
163
+ gemika
164
+ mysql2
165
+ rails (~> 6.0.0)
166
+ rake
167
+ rspec (~> 3.4)
168
+ temporal_tables!
169
+
170
+ BUNDLED WITH
171
+ 2.0.1
@@ -0,0 +1,16 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Runtime dependencies
4
+ gem 'rails', '~> 6.0.0'
5
+ gem 'pg', '>= 0.18', '< 2.0'
6
+
7
+ # Development dependencies
8
+ gem 'rspec', '~> 3.4'
9
+ gem 'rake'
10
+ gem 'byebug'
11
+ gem 'database_cleaner'
12
+ gem 'combustion'
13
+ gem 'gemika'
14
+
15
+ # Gem under test
16
+ gem 'temporal_tables', :path => '..'
@@ -0,0 +1,171 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ temporal_tables (0.7.0)
5
+ rails (>= 5.0, <= 6.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actioncable (6.0.0)
11
+ actionpack (= 6.0.0)
12
+ nio4r (~> 2.0)
13
+ websocket-driver (>= 0.6.1)
14
+ actionmailbox (6.0.0)
15
+ actionpack (= 6.0.0)
16
+ activejob (= 6.0.0)
17
+ activerecord (= 6.0.0)
18
+ activestorage (= 6.0.0)
19
+ activesupport (= 6.0.0)
20
+ mail (>= 2.7.1)
21
+ actionmailer (6.0.0)
22
+ actionpack (= 6.0.0)
23
+ actionview (= 6.0.0)
24
+ activejob (= 6.0.0)
25
+ mail (~> 2.5, >= 2.5.4)
26
+ rails-dom-testing (~> 2.0)
27
+ actionpack (6.0.0)
28
+ actionview (= 6.0.0)
29
+ activesupport (= 6.0.0)
30
+ rack (~> 2.0)
31
+ rack-test (>= 0.6.3)
32
+ rails-dom-testing (~> 2.0)
33
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
34
+ actiontext (6.0.0)
35
+ actionpack (= 6.0.0)
36
+ activerecord (= 6.0.0)
37
+ activestorage (= 6.0.0)
38
+ activesupport (= 6.0.0)
39
+ nokogiri (>= 1.8.5)
40
+ actionview (6.0.0)
41
+ activesupport (= 6.0.0)
42
+ builder (~> 3.1)
43
+ erubi (~> 1.4)
44
+ rails-dom-testing (~> 2.0)
45
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
46
+ activejob (6.0.0)
47
+ activesupport (= 6.0.0)
48
+ globalid (>= 0.3.6)
49
+ activemodel (6.0.0)
50
+ activesupport (= 6.0.0)
51
+ activerecord (6.0.0)
52
+ activemodel (= 6.0.0)
53
+ activesupport (= 6.0.0)
54
+ activestorage (6.0.0)
55
+ actionpack (= 6.0.0)
56
+ activejob (= 6.0.0)
57
+ activerecord (= 6.0.0)
58
+ marcel (~> 0.3.1)
59
+ activesupport (6.0.0)
60
+ concurrent-ruby (~> 1.0, >= 1.0.2)
61
+ i18n (>= 0.7, < 2)
62
+ minitest (~> 5.1)
63
+ tzinfo (~> 1.1)
64
+ zeitwerk (~> 2.1, >= 2.1.8)
65
+ builder (3.2.3)
66
+ byebug (11.0.1)
67
+ combustion (1.1.1)
68
+ activesupport (>= 3.0.0)
69
+ railties (>= 3.0.0)
70
+ thor (>= 0.14.6)
71
+ concurrent-ruby (1.1.5)
72
+ crass (1.0.4)
73
+ database_cleaner (1.7.0)
74
+ diff-lcs (1.3)
75
+ erubi (1.8.0)
76
+ gemika (0.4.0)
77
+ globalid (0.4.2)
78
+ activesupport (>= 4.2.0)
79
+ i18n (1.6.0)
80
+ concurrent-ruby (~> 1.0)
81
+ loofah (2.2.3)
82
+ crass (~> 1.0.2)
83
+ nokogiri (>= 1.5.9)
84
+ mail (2.7.1)
85
+ mini_mime (>= 0.1.1)
86
+ marcel (0.3.3)
87
+ mimemagic (~> 0.3.2)
88
+ method_source (0.9.2)
89
+ mimemagic (0.3.3)
90
+ mini_mime (1.0.2)
91
+ mini_portile2 (2.4.0)
92
+ minitest (5.11.3)
93
+ nio4r (2.5.1)
94
+ nokogiri (1.10.4)
95
+ mini_portile2 (~> 2.4.0)
96
+ pg (1.1.4)
97
+ rack (2.0.7)
98
+ rack-test (1.1.0)
99
+ rack (>= 1.0, < 3)
100
+ rails (6.0.0)
101
+ actioncable (= 6.0.0)
102
+ actionmailbox (= 6.0.0)
103
+ actionmailer (= 6.0.0)
104
+ actionpack (= 6.0.0)
105
+ actiontext (= 6.0.0)
106
+ actionview (= 6.0.0)
107
+ activejob (= 6.0.0)
108
+ activemodel (= 6.0.0)
109
+ activerecord (= 6.0.0)
110
+ activestorage (= 6.0.0)
111
+ activesupport (= 6.0.0)
112
+ bundler (>= 1.3.0)
113
+ railties (= 6.0.0)
114
+ sprockets-rails (>= 2.0.0)
115
+ rails-dom-testing (2.0.3)
116
+ activesupport (>= 4.2.0)
117
+ nokogiri (>= 1.6)
118
+ rails-html-sanitizer (1.2.0)
119
+ loofah (~> 2.2, >= 2.2.2)
120
+ railties (6.0.0)
121
+ actionpack (= 6.0.0)
122
+ activesupport (= 6.0.0)
123
+ method_source
124
+ rake (>= 0.8.7)
125
+ thor (>= 0.20.3, < 2.0)
126
+ rake (12.3.3)
127
+ rspec (3.8.0)
128
+ rspec-core (~> 3.8.0)
129
+ rspec-expectations (~> 3.8.0)
130
+ rspec-mocks (~> 3.8.0)
131
+ rspec-core (3.8.2)
132
+ rspec-support (~> 3.8.0)
133
+ rspec-expectations (3.8.4)
134
+ diff-lcs (>= 1.2.0, < 2.0)
135
+ rspec-support (~> 3.8.0)
136
+ rspec-mocks (3.8.1)
137
+ diff-lcs (>= 1.2.0, < 2.0)
138
+ rspec-support (~> 3.8.0)
139
+ rspec-support (3.8.2)
140
+ sprockets (3.7.2)
141
+ concurrent-ruby (~> 1.0)
142
+ rack (> 1, < 3)
143
+ sprockets-rails (3.2.1)
144
+ actionpack (>= 4.0)
145
+ activesupport (>= 4.0)
146
+ sprockets (>= 3.0.0)
147
+ thor (0.20.3)
148
+ thread_safe (0.3.6)
149
+ tzinfo (1.2.5)
150
+ thread_safe (~> 0.1)
151
+ websocket-driver (0.7.1)
152
+ websocket-extensions (>= 0.1.0)
153
+ websocket-extensions (0.1.4)
154
+ zeitwerk (2.1.9)
155
+
156
+ PLATFORMS
157
+ ruby
158
+
159
+ DEPENDENCIES
160
+ byebug
161
+ combustion
162
+ database_cleaner
163
+ gemika
164
+ pg (>= 0.18, < 2.0)
165
+ rails (~> 6.0.0)
166
+ rake
167
+ rspec (~> 3.4)
168
+ temporal_tables!
169
+
170
+ BUNDLED WITH
171
+ 2.0.1
@@ -0,0 +1,19 @@
1
+ module TemporalTables
2
+ # This is required for eager_load to work in Rails 6.0
3
+ module ArelTable
4
+ def create_join(to, constraint = nil, klass = Nodes::InnerJoin)
5
+ join = super
6
+ if at_value = Thread.current[:at_time]
7
+ join = join.
8
+ and(to[:eff_to].gteq(at_value)).
9
+ and(to[:eff_from].lteq(at_value))
10
+ end
11
+ join
12
+ end
13
+ end
14
+ end
15
+
16
+ case Rails::VERSION::MAJOR
17
+ when 6
18
+ Arel::Table.prepend TemporalTables::ArelTable
19
+ end
@@ -1,20 +1,20 @@
1
1
  module TemporalTables
2
- # Uses the time from the "at" field stored in the record to filter queries
3
- # made to associations.
4
- module AssociationExtensions
5
- def target_scope
6
- # Kludge: Check +public_methods+ instead of using +responds_to?+ to
7
- # bypass +delegate_missing_to+ calls, as in +ActiveStorage::Attachment+.
8
- # Using responds_to? results in an infinite loop stack overflow.
9
- if @owner.public_methods.include?(:at_value)
10
- # If this is a history record but no at time was given,
11
- # assume the record's effective to date
12
- super.at(@owner.at_value || @owner.eff_to)
13
- else
14
- super
15
- end
16
- end
17
- end
2
+ # Uses the time from the "at" field stored in the record to filter queries
3
+ # made to associations.
4
+ module AssociationExtensions
5
+ def target_scope
6
+ # Kludge: Check +public_methods+ instead of using +responds_to?+ to
7
+ # bypass +delegate_missing_to+ calls, as in +ActiveStorage::Attachment+.
8
+ # Using responds_to? results in an infinite loop stack overflow.
9
+ if @owner.public_methods.include?(:at_value)
10
+ # If this is a history record but no at time was given,
11
+ # assume the record's effective to date
12
+ super.at(@owner.at_value || @owner.eff_to)
13
+ else
14
+ super
15
+ end
16
+ end
17
+ end
18
18
  end
19
19
 
20
20
  ActiveRecord::Associations::Association.prepend TemporalTables::AssociationExtensions