archival_record 2.0.2 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.gitlab-ci.yml +20 -0
- data/.rubocop.yml +7 -5
- data/.rubocop_todo.yml +1 -8
- data/Appraisals +8 -11
- data/CHANGELOG.md +15 -0
- data/Gemfile.lock +77 -43
- data/LICENSE +5 -2
- data/README.md +36 -12
- data/archival_record.gemspec +36 -31
- data/gemfiles/{rails_5.1.gemfile → rails_6.1.gemfile} +1 -2
- data/gemfiles/{rails_5.2.gemfile → rails_7.0.gemfile} +1 -2
- data/gemfiles/{rails_5.0.gemfile → rails_7.1.gemfile} +1 -2
- data/init.rb +2 -2
- data/lib/archival_record/version.rb +1 -1
- data/lib/archival_record.rb +5 -5
- data/lib/archival_record_core/archival_record.rb +38 -21
- data/lib/archival_record_core/archival_record_active_record_methods.rb +3 -2
- data/lib/archival_record_core/association_operation/base.rb +4 -2
- data/test/application_record_test.rb +1 -1
- data/test/archive_dependents_option_test.rb +54 -0
- data/test/basic_test.rb +5 -5
- data/test/bogus_relation_test.rb +22 -0
- data/test/deep_nesting_test.rb +1 -1
- data/test/fixtures/bogus_relation.rb +6 -0
- data/test/fixtures/explicit_act_on_dependents_archival.rb +9 -0
- data/test/fixtures/ignorable_dependent.rb +10 -0
- data/test/fixtures/ignore_dependents_archival.rb +9 -0
- data/test/fixtures/nonignorable_dependent.rb +10 -0
- data/test/polymorphic_test.rb +2 -2
- data/test/relations_test.rb +1 -1
- data/test/schema.rb +27 -0
- data/test/scope_test.rb +4 -10
- data/test/test_helper.rb +19 -25
- data/test/transaction_test.rb +2 -1
- metadata +55 -53
- data/.travis.yml +0 -23
- data/test/fixtures/callback_archival_4.rb +0 -19
- /data/test/fixtures/{callback_archival_5.rb → callback_archival.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de698cb4c6c28dbc975343cbb8c64040423a401fe1963486e4d43feacdaf70fd
|
4
|
+
data.tar.gz: 423dc258212a7b8ff4fb78a6acc29bc979846820c50263859e0d9d2a9e634c81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a24054ef6cd9fc3ed12233e10e11fa194e26f72499534925bdd4d4bad05b9245bb994763ba6b449b7100e48dda00ce30de641b51f9d6a797697fba2805335f84
|
7
|
+
data.tar.gz: 3dab3e39d40c31fcfe60129b8eb9a3fb420be3ece65c18a7bfa3da367026b9c44ecee1e4b721ea71bd28cc85920308d427d391ddab10e2a0a82e1e2203e9ff30
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
image: "ruby:3.2"
|
2
|
+
|
3
|
+
before_script:
|
4
|
+
- apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs
|
5
|
+
- ruby -v
|
6
|
+
- which ruby
|
7
|
+
- gem install bundler --no-document
|
8
|
+
- bundle install --jobs $(nproc) "${FLAGS[@]}"
|
9
|
+
- bundle install --gemfile=gemfiles/rails_6.0.gemfile
|
10
|
+
- bundle install --gemfile=gemfiles/rails_6.1.gemfile
|
11
|
+
- bundle install --gemfile=gemfiles/rails_7.0.gemfile
|
12
|
+
- bundle install --gemfile=gemfiles/rails_7.1.gemfile
|
13
|
+
|
14
|
+
rake:
|
15
|
+
script:
|
16
|
+
- bundle exec rake
|
17
|
+
|
18
|
+
appraisal:
|
19
|
+
script:
|
20
|
+
- bundle exec appraisal rake
|
data/.rubocop.yml
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
|
+
require:
|
3
|
+
- rubocop-rails
|
4
|
+
- rubocop-rake
|
2
5
|
|
3
6
|
AllCops:
|
4
7
|
Exclude:
|
5
8
|
- vendor/**/*
|
6
9
|
- gemfiles/**/*
|
7
|
-
TargetRubyVersion:
|
10
|
+
TargetRubyVersion: 3.0
|
8
11
|
NewCops: enable
|
9
12
|
|
10
13
|
|
@@ -17,9 +20,6 @@ Layout/EmptyLinesAroundClassBody:
|
|
17
20
|
Layout/EmptyLinesAroundModuleBody:
|
18
21
|
EnforcedStyle: empty_lines_except_namespace
|
19
22
|
|
20
|
-
Layout/LineLength:
|
21
|
-
Max: 140
|
22
|
-
|
23
23
|
Layout/SpaceInsideHashLiteralBraces:
|
24
24
|
EnforcedStyle: space
|
25
25
|
|
@@ -52,6 +52,7 @@ Style/Alias:
|
|
52
52
|
Style/AsciiComments:
|
53
53
|
Enabled: false
|
54
54
|
|
55
|
+
# TODO: class documentation
|
55
56
|
Style/Documentation:
|
56
57
|
Enabled: false
|
57
58
|
|
@@ -66,9 +67,10 @@ Style/FrozenStringLiteralComment:
|
|
66
67
|
|
67
68
|
Style/HashSyntax:
|
68
69
|
EnforcedStyle: ruby19
|
70
|
+
EnforcedShorthandSyntax: always
|
69
71
|
|
70
72
|
Style/RaiseArgs:
|
71
|
-
EnforcedStyle:
|
73
|
+
EnforcedStyle: exploded
|
72
74
|
|
73
75
|
Style/StringLiterals:
|
74
76
|
EnforcedStyle: double_quotes
|
data/.rubocop_todo.yml
CHANGED
@@ -1,14 +1,7 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2024-06-11 01:38:42 UTC using RuboCop version 1.64.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 7
|
10
|
-
# Cop supports --auto-correct.
|
11
|
-
Lint/SendWithMixinArgument:
|
12
|
-
Exclude:
|
13
|
-
- 'init.rb'
|
14
|
-
- 'lib/archival_record.rb'
|
data/Appraisals
CHANGED
@@ -1,18 +1,15 @@
|
|
1
|
-
appraise "rails-
|
2
|
-
gem "rails", "~>
|
3
|
-
gem "sqlite3", "~> 1.3.13"
|
1
|
+
appraise "rails-6.0" do
|
2
|
+
gem "rails", "~> 6.0.0"
|
4
3
|
end
|
5
4
|
|
6
|
-
appraise "rails-
|
7
|
-
gem "rails", "~>
|
8
|
-
gem "sqlite3", "~> 1.4.1"
|
5
|
+
appraise "rails-6.1" do
|
6
|
+
gem "rails", "~> 6.1.0"
|
9
7
|
end
|
10
8
|
|
11
|
-
appraise "rails-
|
12
|
-
gem "rails", "~>
|
13
|
-
gem "sqlite3", "~> 1.4.1"
|
9
|
+
appraise "rails-7.0" do
|
10
|
+
gem "rails", "~> 7.0.0"
|
14
11
|
end
|
15
12
|
|
16
|
-
appraise "rails-
|
17
|
-
gem "rails", "~>
|
13
|
+
appraise "rails-7.1" do
|
14
|
+
gem "rails", "~> 7.1.0"
|
18
15
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 3.0.1 - June 10, 2024
|
4
|
+
* a few more tidying items like fixing up some raw sql in a query to be arel
|
5
|
+
* changing a logging method to use error instead of debug so it surfaces more easily
|
6
|
+
|
7
|
+
## 3.0.0 - June 10, 2024
|
8
|
+
* **BREAKING CHANGE** Drop support for rails 5 - see `rails__4.x-and-5.x` branch for relevant code
|
9
|
+
* **BREAKING CHANGE** Drop support for Ruby 2.x
|
10
|
+
* **ADDED** new option for `archival_record` called `archive_dependents` which can control whether `dependent: :destroy` records are archived with their parent
|
11
|
+
* lots of cleanup of code, particularly the way `ApplicationRecord` gets patched
|
12
|
+
* remove travis-ci, use gitlab pipelines
|
13
|
+
|
14
|
+
## 2.0.2 - August 4, 2020
|
15
|
+
* fixing travis
|
16
|
+
* updating git hosting link
|
17
|
+
|
3
18
|
## 2.0.1 - August 3, 2020
|
4
19
|
* Add security policy
|
5
20
|
* Update depenedent gems: archival_record (:D oops) and rubocop, and dependencies
|
data/Gemfile.lock
CHANGED
@@ -1,60 +1,92 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
archival_record (
|
5
|
-
activerecord (>=
|
4
|
+
archival_record (3.0.1)
|
5
|
+
activerecord (>= 6.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (
|
11
|
-
activesupport (=
|
12
|
-
activerecord (
|
13
|
-
activemodel (=
|
14
|
-
activesupport (=
|
15
|
-
|
10
|
+
activemodel (7.1.3.4)
|
11
|
+
activesupport (= 7.1.3.4)
|
12
|
+
activerecord (7.1.3.4)
|
13
|
+
activemodel (= 7.1.3.4)
|
14
|
+
activesupport (= 7.1.3.4)
|
15
|
+
timeout (>= 0.4.0)
|
16
|
+
activesupport (7.1.3.4)
|
17
|
+
base64
|
18
|
+
bigdecimal
|
16
19
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
connection_pool (>= 2.2.5)
|
21
|
+
drb
|
22
|
+
i18n (>= 1.6, < 2)
|
23
|
+
minitest (>= 5.1)
|
24
|
+
mutex_m
|
25
|
+
tzinfo (~> 2.0)
|
26
|
+
appraisal (2.5.0)
|
22
27
|
bundler
|
23
28
|
rake
|
24
29
|
thor (>= 0.14.0)
|
25
|
-
ast (2.4.
|
26
|
-
|
27
|
-
|
28
|
-
|
30
|
+
ast (2.4.2)
|
31
|
+
base64 (0.2.0)
|
32
|
+
bigdecimal (3.1.8)
|
33
|
+
concurrent-ruby (1.3.3)
|
34
|
+
connection_pool (2.4.1)
|
35
|
+
database_cleaner (2.0.2)
|
36
|
+
database_cleaner-active_record (>= 2, < 3)
|
37
|
+
database_cleaner-active_record (2.1.0)
|
38
|
+
activerecord (>= 5.a)
|
39
|
+
database_cleaner-core (~> 2.0.0)
|
40
|
+
database_cleaner-core (2.0.1)
|
41
|
+
drb (2.2.1)
|
42
|
+
i18n (1.14.5)
|
29
43
|
concurrent-ruby (~> 1.0)
|
30
|
-
|
31
|
-
|
32
|
-
|
44
|
+
json (2.7.2)
|
45
|
+
language_server-protocol (3.17.0.3)
|
46
|
+
mini_portile2 (2.8.7)
|
47
|
+
minitest (5.23.1)
|
48
|
+
mutex_m (0.2.0)
|
49
|
+
parallel (1.25.1)
|
50
|
+
parser (3.3.2.0)
|
33
51
|
ast (~> 2.4.1)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
52
|
+
racc
|
53
|
+
racc (1.8.0)
|
54
|
+
rack (3.0.11)
|
55
|
+
rainbow (3.1.1)
|
56
|
+
rake (13.2.1)
|
57
|
+
regexp_parser (2.9.2)
|
58
|
+
rexml (3.2.9)
|
59
|
+
strscan
|
60
|
+
rr (3.1.0)
|
61
|
+
rubocop (1.64.1)
|
62
|
+
json (~> 2.3)
|
63
|
+
language_server-protocol (>= 3.17.0)
|
40
64
|
parallel (~> 1.10)
|
41
|
-
parser (>=
|
65
|
+
parser (>= 3.3.0.2)
|
42
66
|
rainbow (>= 2.2.2, < 4.0)
|
43
|
-
regexp_parser (>= 1.
|
44
|
-
rexml
|
45
|
-
rubocop-ast (>=
|
67
|
+
regexp_parser (>= 1.8, < 3.0)
|
68
|
+
rexml (>= 3.2.5, < 4.0)
|
69
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
46
70
|
ruby-progressbar (~> 1.7)
|
47
|
-
unicode-display_width (>=
|
48
|
-
rubocop-ast (
|
49
|
-
parser (>=
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
71
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
72
|
+
rubocop-ast (1.31.3)
|
73
|
+
parser (>= 3.3.1.0)
|
74
|
+
rubocop-rails (2.25.0)
|
75
|
+
activesupport (>= 4.2.0)
|
76
|
+
rack (>= 1.1)
|
77
|
+
rubocop (>= 1.33.0, < 2.0)
|
78
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
79
|
+
rubocop-rake (0.6.0)
|
80
|
+
rubocop (~> 1.0)
|
81
|
+
ruby-progressbar (1.13.0)
|
82
|
+
sqlite3 (1.7.3)
|
83
|
+
mini_portile2 (~> 2.8.0)
|
84
|
+
strscan (3.1.0)
|
85
|
+
thor (1.3.1)
|
86
|
+
timeout (0.4.1)
|
87
|
+
tzinfo (2.0.6)
|
88
|
+
concurrent-ruby (~> 1.0)
|
89
|
+
unicode-display_width (2.5.0)
|
58
90
|
|
59
91
|
PLATFORMS
|
60
92
|
ruby
|
@@ -66,7 +98,9 @@ DEPENDENCIES
|
|
66
98
|
rake
|
67
99
|
rr
|
68
100
|
rubocop
|
69
|
-
|
101
|
+
rubocop-rails
|
102
|
+
rubocop-rake
|
103
|
+
sqlite3 (< 2)
|
70
104
|
|
71
105
|
BUNDLED WITH
|
72
|
-
2.
|
106
|
+
2.5.11
|
data/LICENSE
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
Copyright for portions of project ArchivalRecord are held by Expected Behavior,
|
1
|
+
Copyright for portions of project ArchivalRecord are held by Expected Behavior,
|
2
|
+
2009-2020 as part of project ActsAsArchival.
|
3
|
+
|
4
|
+
All other copyright for project ArchivalRecord are held by Joel Meador, 2020.
|
2
5
|
|
3
6
|
-----
|
4
7
|
|
5
|
-
LICENSE for [ArchivalRecord](https://
|
8
|
+
LICENSE for [ArchivalRecord](https://gitlab.com/joelmeador/archival_record/)
|
6
9
|
|
7
10
|
Copyright (c) 2020 Joel Meador
|
8
11
|
|
data/README.md
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# ArchivalRecord
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/janxious/archival_record.svg?branch=main)](https://travis-ci.org/janxious/archival_record)
|
4
|
-
[![Gem Version](https://badge.fury.io/rb/archival_record.svg)](https://badge.fury.io/rb/archival_record)
|
5
|
-
|
6
3
|
Atomically archive object trees in your ActiveRecord models.
|
7
4
|
|
8
5
|
`acts_as_paranoid` and similar plugins/gems work on a record-by-record basis and made it difficult to restore records atomically (or archive them, for that matter).
|
@@ -11,6 +8,8 @@ Because the `#archive!` and `#unarchive!` methods are in transactions, and every
|
|
11
8
|
|
12
9
|
Additionally, other plugins generally change how `destroy`/`delete` work. ArchivalRecord does not, and thus one can destroy records like normal.
|
13
10
|
|
11
|
+
_This is a fork of [ActsAsArchival](https://github.com/expectedbehavior/acts_as_archival/)._
|
12
|
+
|
14
13
|
## Maintenance
|
15
14
|
|
16
15
|
You might read the commit logs and think "This must be abandonware! This hasn't been updated in 2y!" But! This is a mature project that solves a specific problem in ActiveRecord. It tends to only be updated when a new major version of ActiveRecord comes out and hence the infrequent updates.
|
@@ -21,23 +20,23 @@ Gemfile:
|
|
21
20
|
|
22
21
|
`gem "archival_record"`
|
23
22
|
|
24
|
-
Any models you want to be archival should have the columns `archive_number` (String) and `archived_at` (DateTime).
|
23
|
+
Any models you want to be archival should have the columns `archive_number` (`String`) and `archived_at` (`DateTime`).
|
25
24
|
|
26
25
|
i.e. `rails g migration AddArchivalRecordToPost archive_number archived_at:datetime`
|
27
26
|
|
28
27
|
Any dependent-destroy ArchivalRecord model associated to an ArchivalRecord model will be archived with its parent.
|
29
28
|
|
30
|
-
_If you're stuck on Rails
|
29
|
+
_If you're stuck on Rails 5x/4x/3x/2x, check out the older tags/branches, which are no longer in active development._
|
31
30
|
|
32
31
|
## Example
|
33
32
|
|
34
33
|
``` ruby
|
35
|
-
class Hole <
|
34
|
+
class Hole < ApplicationRecord
|
36
35
|
archival_record
|
37
36
|
has_many :rats, dependent: :destroy
|
38
37
|
end
|
39
38
|
|
40
|
-
class Rat <
|
39
|
+
class Rat < ApplicationRecord
|
41
40
|
archival_record
|
42
41
|
end
|
43
42
|
```
|
@@ -112,12 +111,13 @@ Hole.archival? # => true
|
|
112
111
|
|
113
112
|
### Options
|
114
113
|
|
114
|
+
#### `readonly_when_archived`
|
115
115
|
When defining an ArchivalRecord model, it is is possible to make it unmodifiable
|
116
116
|
when it is archived by passing `readonly_when_archived: true` to the
|
117
|
-
`archival_record` call in your model.
|
117
|
+
`archival_record` call in your model. The default value of this option is `false`.
|
118
118
|
|
119
119
|
``` ruby
|
120
|
-
class CantTouchThis <
|
120
|
+
class CantTouchThis < ApplicationRecord
|
121
121
|
archival_record readonly_when_archived: true
|
122
122
|
end
|
123
123
|
|
@@ -128,12 +128,32 @@ record.save # => false
|
|
128
128
|
record.errors.full_messages.first # => "Cannot modify an archived record."
|
129
129
|
```
|
130
130
|
|
131
|
+
#### `archive_dependents`
|
132
|
+
When defining an ArchivalRecord model, it is possible to deactivate archiving/unarchiving for `dependent: :destroy` relationships that are tied to ArchivalRecord models by passing `archive_dependents: false` to the `archival_record` call in your model. The default value of this option is `true`.
|
133
|
+
|
134
|
+
``` ruby
|
135
|
+
class WillArchive < ApplicationRecord
|
136
|
+
archival_record archive_dependents: false
|
137
|
+
has_many :wont_archives, dependent: :destroy
|
138
|
+
end
|
139
|
+
class WontArchive < ApplicationRecord
|
140
|
+
archival_record
|
141
|
+
end
|
142
|
+
|
143
|
+
record = WillArchive.create
|
144
|
+
wont_archive = record.wont_archives.create
|
145
|
+
record.archive!
|
146
|
+
|
147
|
+
record.archived? # => true
|
148
|
+
wont_archive.archived? # => false
|
149
|
+
```
|
150
|
+
|
131
151
|
### Callbacks
|
132
152
|
|
133
153
|
ArchivalRecord models have four additional callbacks to do any necessary cleanup or other processing before and after archiving and unarchiving, and can additionally halt the archive callback chain.
|
134
154
|
|
135
155
|
``` ruby
|
136
|
-
class Hole <
|
156
|
+
class Hole < ApplicationRecord
|
137
157
|
archival_record
|
138
158
|
|
139
159
|
# runs before #archive!
|
@@ -160,8 +180,12 @@ end
|
|
160
180
|
## Caveats
|
161
181
|
|
162
182
|
1. This will only work on associations that are dependent destroy. It
|
163
|
-
should be
|
164
|
-
1. If you would like to work on this, you will need to setup sqlite on your development machine. Alternately, you can
|
183
|
+
should be trivial to change that or make it optional.
|
184
|
+
1. If you would like to work on this, you will need to setup sqlite on your development machine. Alternately, you can deactivate specific dev dependencies in the gemspec and test_helper and ask for help.
|
185
|
+
|
186
|
+
## Compatibility with ActsAsArchival
|
187
|
+
|
188
|
+
For now, the `acts_as_archival` class method can be used, though it will print a deprecation warning. This is to allow users to transition without trouble to this library if they choose to.
|
165
189
|
|
166
190
|
## Testing
|
167
191
|
|
data/archival_record.gemspec
CHANGED
@@ -3,40 +3,44 @@ $LOAD_PATH.push File.expand_path("lib", __dir__)
|
|
3
3
|
require "archival_record/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
|
-
gem.name
|
7
|
-
gem.summary
|
8
|
-
gem.version
|
9
|
-
gem.authors
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
gem.email
|
25
|
-
gem.homepage
|
26
|
-
|
27
|
-
|
28
|
-
gem.
|
6
|
+
gem.name = "archival_record"
|
7
|
+
gem.summary = "Atomic archiving/unarchiving for ActiveRecord"
|
8
|
+
gem.version = ArchivalRecord::VERSION
|
9
|
+
gem.authors = ["Joel Meador",
|
10
|
+
"Michael Kuehl",
|
11
|
+
"Matthew Gordon",
|
12
|
+
"Vojtech Salbaba",
|
13
|
+
"David Jones",
|
14
|
+
"Dave Woodward",
|
15
|
+
"Miles Sterrett",
|
16
|
+
"James Hill",
|
17
|
+
"Maarten Claes",
|
18
|
+
"Anthony Panozzo",
|
19
|
+
"Aaron Milam",
|
20
|
+
"Anton Rieder",
|
21
|
+
"Josh Menden",
|
22
|
+
"Sergey Gnuskov",
|
23
|
+
"Elijah Miller"]
|
24
|
+
gem.email = ["joel.meador+archival_record@gmail.com"]
|
25
|
+
gem.homepage = "https://gitlab.com/joelmeador/archival_record/"
|
26
|
+
gem.licenses = ["MIT"]
|
27
|
+
|
28
|
+
gem.files = `git ls-files`.split("\n")
|
29
29
|
gem.require_paths = ["lib"]
|
30
|
-
gem.required_ruby_version = ">=
|
30
|
+
gem.required_ruby_version = ">= 3.0"
|
31
31
|
|
32
|
-
gem.add_dependency
|
32
|
+
gem.add_dependency("activerecord", ">= 6.0")
|
33
33
|
|
34
|
-
|
35
|
-
gem.add_development_dependency
|
36
|
-
gem.add_development_dependency
|
37
|
-
gem.add_development_dependency
|
38
|
-
gem.add_development_dependency
|
39
|
-
gem.add_development_dependency
|
34
|
+
# rubocop:disable Gemspec/DevelopmentDependencies
|
35
|
+
gem.add_development_dependency("appraisal")
|
36
|
+
gem.add_development_dependency("database_cleaner")
|
37
|
+
gem.add_development_dependency("rake")
|
38
|
+
gem.add_development_dependency("rr")
|
39
|
+
gem.add_development_dependency("rubocop")
|
40
|
+
gem.add_development_dependency("rubocop-rails")
|
41
|
+
gem.add_development_dependency("rubocop-rake")
|
42
|
+
gem.add_development_dependency("sqlite3", "< 2")
|
43
|
+
# rubocop:enable Gemspec/DevelopmentDependencies
|
40
44
|
|
41
45
|
gem.description =
|
42
46
|
<<~DESCRIPTION
|
@@ -48,4 +52,5 @@ Gem::Specification.new do |gem|
|
|
48
52
|
|
49
53
|
Additionally, other plugins generally change how destroy/delete work. ArchivalRecord does not, and thus one can destroy records like normal.
|
50
54
|
DESCRIPTION
|
55
|
+
gem.metadata["rubygems_mfa_required"] = "true"
|
51
56
|
end
|
data/init.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
# Include hook code here
|
2
|
-
|
3
|
-
|
2
|
+
ActiveSupport.on_load(:active_record) { include ArchivalRecordCore::ArchivalRecordActiveRecordMethods }
|
3
|
+
ActiveSupport.on_load(:active_record) { include ArchivalRecordCore::ArchivalRecord }
|
data/lib/archival_record.rb
CHANGED
@@ -9,11 +9,11 @@ require "archival_record_core/archival_record_active_record_methods"
|
|
9
9
|
|
10
10
|
# This assumes a fully Rails 5 compatible set of ActiveRecord models
|
11
11
|
if defined?(ApplicationRecord)
|
12
|
-
ApplicationRecord.
|
13
|
-
ApplicationRecord.
|
12
|
+
ApplicationRecord.include ArchivalRecordCore::ArchivalRecord
|
13
|
+
ApplicationRecord.include ArchivalRecordCore::ArchivalRecordActiveRecordMethods
|
14
14
|
else
|
15
|
-
|
16
|
-
|
15
|
+
ActiveSupport.on_load(:active_record) { include ArchivalRecordCore::ArchivalRecord }
|
16
|
+
ActiveSupport.on_load(:active_record) { include ArchivalRecordCore::ArchivalRecordActiveRecordMethods }
|
17
17
|
end
|
18
18
|
|
19
|
-
ActiveRecord::Relation.
|
19
|
+
ActiveRecord::Relation.include ArchivalRecordCore::ArchivalRecordActiveRecordMethods::ARRelationMethods
|