acts_as_paranoid 0.9.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/CONTRIBUTING.md +19 -13
- data/README.md +4 -4
- data/lib/acts_as_paranoid/associations.rb +1 -0
- data/lib/acts_as_paranoid/core.rb +5 -8
- data/lib/acts_as_paranoid/version.rb +1 -1
- data/lib/acts_as_paranoid.rb +12 -10
- metadata +35 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45d8ec4adf62543fc1eaba6560fde9b075ecf0fef95b8e2d2811ee08a9093d24
|
4
|
+
data.tar.gz: 51da12bf09c6d0aab09d835d44aa7a74e617ad5f31b0a624af32148ffb63b17c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d419f338d8ab828856188404eb2c1f84f31508af15cae65fee647c050ed1efbe41f69951ebf0f3e9de69a5416b0ff7157fb3ad999642eae0dc4dc804fce59634
|
7
|
+
data.tar.gz: 236842d046c63ac8b0efedf5937911ddca18a7232006d7459fb19027902ef38534b70a32c674916972c9b7aec08b1c6f109e6c07979b1de1afdf88a7c6a45094
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,30 @@
|
|
2
2
|
|
3
3
|
Notable changes to this project will be documented in this file.
|
4
4
|
|
5
|
+
## 0.10.1
|
6
|
+
|
7
|
+
* Add changelog_uri to gemspec ([#332] by [fynsta])
|
8
|
+
* Improve contribution instructions ([#338] by [mvz])
|
9
|
+
* Make with_deleted work with paranoid join records ([#339] by [mvz])
|
10
|
+
|
11
|
+
[fynsta]: https://github.com/fynsta
|
12
|
+
|
13
|
+
[#332]: https://github.com/ActsAsParanoid/acts_as_paranoid/pull/332
|
14
|
+
[#338]: https://github.com/ActsAsParanoid/acts_as_paranoid/pull/338
|
15
|
+
[#339]: https://github.com/ActsAsParanoid/acts_as_paranoid/pull/339
|
16
|
+
|
17
|
+
## 0.10.0
|
18
|
+
|
19
|
+
* Support Ruby 3.0 through 3.3, dropping support for 2.7 ([#322] by [mvz])
|
20
|
+
* Use correct sqlite3 versions in tests ([#329] by [fatkodima])
|
21
|
+
* Do not load `ActiveRecord` too early ([#330] by [fatkodima])
|
22
|
+
|
23
|
+
[fatkodima]: https://github.com/fatkodima
|
24
|
+
|
25
|
+
[#322]: https://github.com/ActsAsParanoid/acts_as_paranoid/pull/322
|
26
|
+
[#329]: https://github.com/ActsAsParanoid/acts_as_paranoid/pull/329
|
27
|
+
[#330]: https://github.com/ActsAsParanoid/acts_as_paranoid/pull/330
|
28
|
+
|
5
29
|
## 0.9.0
|
6
30
|
|
7
31
|
* Support JRuby 9.4 ([#299] by [Matijs van Zuijlen][mvz])
|
data/CONTRIBUTING.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Contributing to ActsAsParanoid
|
2
2
|
|
3
|
-
We welcome
|
4
|
-
|
3
|
+
We welcome contributions to ActsAsParanoid. Please follow the guidelines below to help the
|
4
|
+
process of handling issues and pull requests go smoothly.
|
5
5
|
|
6
6
|
## Issues
|
7
7
|
|
@@ -14,30 +14,35 @@ ticket.
|
|
14
14
|
- Describe what you are trying to achieve
|
15
15
|
- Describe what you did, preferably including relevant code
|
16
16
|
- Describe what you expected to happen
|
17
|
-
- Describe what happened instead
|
17
|
+
- Describe what happened instead. Include relevant output if possible
|
18
|
+
- State the version of ActsAsParanoid you are using
|
18
19
|
- Use [code blocks](https://github.github.com/gfm/#fenced-code-blocks) to
|
19
20
|
format any code and output in your ticket to make it readable.
|
20
21
|
|
21
|
-
## Pull
|
22
|
+
## Pull Requests
|
22
23
|
|
23
24
|
If you have an idea for a particular feature, it's probably best to create a
|
24
25
|
GitHub issue for it before trying to implement it yourself. That way, we can
|
25
26
|
discuss the feature and whether it makes sense to include in ActsAsParanoid itself
|
26
27
|
before putting in the work to implement it.
|
27
28
|
|
28
|
-
|
29
|
-
**If you get stuck, please make a pull request anyway and we'll try to
|
30
|
-
help out.**
|
29
|
+
When sending a pull request, please follow **all of** the instructions below:
|
31
30
|
|
32
|
-
- Make sure `bundle exec rake` runs without reporting any failures.
|
33
|
-
|
34
|
-
|
31
|
+
- Make sure `bundle exec rake` runs without reporting any failures. See
|
32
|
+
*Testing your changes* below for more details.
|
33
|
+
- Add tests for your feature. Otherwise, we can't see if it works or if
|
34
|
+
we break it later.
|
35
35
|
- Create a separate branch for your feature based off of latest master.
|
36
|
+
- Write [good commit messages](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
36
37
|
- Do not include changes that are irrelevant to your feature in the same
|
37
38
|
commit.
|
38
39
|
- Keep an eye on the build results in GitHub Actions. If the build fails and it
|
39
40
|
seems due to your changes, please update your pull request with a fix.
|
40
41
|
|
42
|
+
If you're not sure how to test the problem, or what the best solution is, or
|
43
|
+
get stuck on something else, please open an issue first so that we can discuss
|
44
|
+
the best approach.
|
45
|
+
|
41
46
|
### Testing your changes
|
42
47
|
|
43
48
|
You can run the test suite with the latest version of all dependencies by running the following:
|
@@ -62,9 +67,10 @@ documentation for details.
|
|
62
67
|
that just fix a mistake in a previous commits, we will ask you to clean up
|
63
68
|
the history.
|
64
69
|
Again, [the git-rebase guide](https://git-rebase.io/) should help out.
|
65
|
-
|
66
|
-
|
70
|
+
Note that we will not squash-merge pull requests, since that results in a loss of history.
|
71
|
+
- **At the end of the review process we may still choose not to merge your pull
|
72
|
+
request.** For example, this could happen if we decide the proposed feature
|
67
73
|
should not be part of ActsAsParanoid, or if the technical implementation does not
|
68
|
-
match where we want to go with the architecture the project.
|
74
|
+
match where we want to go with the architecture of the project.
|
69
75
|
- We will generally not merge any pull requests that make the build fail, unless
|
70
76
|
it's very clearly not related to the changes in the pull request.
|
data/README.md
CHANGED
@@ -9,9 +9,9 @@ recoverable later.
|
|
9
9
|
|
10
10
|
## Support
|
11
11
|
|
12
|
-
**This version targets Rails 6.1+ and Ruby
|
12
|
+
**This version targets Rails 6.1+ and Ruby 3.0+ only**
|
13
13
|
|
14
|
-
If you're working with Rails 6.0 and earlier, or with Ruby 2.
|
14
|
+
If you're working with Rails 6.0 and earlier, or with Ruby 2.7 or earlier,
|
15
15
|
please require an older version of the `acts_as_paranoid` gem.
|
16
16
|
|
17
17
|
### Known issues
|
@@ -23,7 +23,7 @@ please require an older version of the `acts_as_paranoid` gem.
|
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
26
|
-
#### Install gem
|
26
|
+
#### Install gem
|
27
27
|
|
28
28
|
```ruby
|
29
29
|
gem 'acts_as_paranoid'
|
@@ -245,7 +245,7 @@ p1.recover #=> fails validation!
|
|
245
245
|
|
246
246
|
### Status
|
247
247
|
|
248
|
-
A paranoid object could be deleted or destroyed fully.
|
248
|
+
A paranoid object could be deleted or destroyed fully.
|
249
249
|
|
250
250
|
You can check if the object is deleted with the `deleted?` helper
|
251
251
|
|
@@ -118,13 +118,10 @@ module ActsAsParanoid
|
|
118
118
|
def without_paranoid_default_scope
|
119
119
|
scope = all
|
120
120
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
ActiveRecord::Relation::WhereClause.new([paranoid_default_scope])
|
126
|
-
|
127
|
-
scope.where_clause = all.where_clause - paranoid_where_clause
|
121
|
+
unless scope.unscope_values.include?({ where: paranoid_column })
|
122
|
+
# unscope avoids applying the default scope when using this scope for associations
|
123
|
+
scope = scope.unscope(where: paranoid_column)
|
124
|
+
end
|
128
125
|
|
129
126
|
scope
|
130
127
|
end
|
@@ -312,7 +309,7 @@ module ActsAsParanoid
|
|
312
309
|
end
|
313
310
|
|
314
311
|
def each_counter_cached_association_reflection
|
315
|
-
_reflections.
|
312
|
+
_reflections.each_value do |reflection|
|
316
313
|
yield reflection if reflection.belongs_to? && reflection.counter_cache_column
|
317
314
|
end
|
318
315
|
end
|
data/lib/acts_as_paranoid.rb
CHANGED
@@ -51,17 +51,19 @@ module ActsAsParanoid
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
|
55
|
-
ActiveRecord
|
54
|
+
ActiveSupport.on_load(:active_record) do
|
55
|
+
# Extend ActiveRecord's functionality
|
56
|
+
extend ActsAsParanoid
|
56
57
|
|
57
|
-
# Extend ActiveRecord::Base with paranoid associations
|
58
|
-
|
58
|
+
# Extend ActiveRecord::Base with paranoid associations
|
59
|
+
include ActsAsParanoid::Associations
|
59
60
|
|
60
|
-
# Override ActiveRecord::Relation's behavior
|
61
|
-
ActiveRecord::Relation.include ActsAsParanoid::Relation
|
61
|
+
# Override ActiveRecord::Relation's behavior
|
62
|
+
ActiveRecord::Relation.include ActsAsParanoid::Relation
|
62
63
|
|
63
|
-
# Push the recover callback onto the activerecord callback list
|
64
|
-
ActiveRecord::Callbacks::CALLBACKS.push(:before_recover, :after_recover)
|
64
|
+
# Push the recover callback onto the activerecord callback list
|
65
|
+
ActiveRecord::Callbacks::CALLBACKS.push(:before_recover, :after_recover)
|
65
66
|
|
66
|
-
ActiveRecord::Reflection::AssociationReflection
|
67
|
-
|
67
|
+
ActiveRecord::Reflection::AssociationReflection
|
68
|
+
.prepend ActsAsParanoid::AssociationReflection
|
69
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_paranoid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zachary Scott
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-07-28 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '5.14'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: minitest-around
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.5'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.5'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: minitest-focus
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +108,20 @@ dependencies:
|
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '1.3'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: minitest-stub-const
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.6'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.6'
|
97
125
|
- !ruby/object:Gem::Dependency
|
98
126
|
name: pry
|
99
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,14 +198,14 @@ dependencies:
|
|
170
198
|
requirements:
|
171
199
|
- - "~>"
|
172
200
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.
|
201
|
+
version: 0.35.0
|
174
202
|
type: :development
|
175
203
|
prerelease: false
|
176
204
|
version_requirements: !ruby/object:Gem::Requirement
|
177
205
|
requirements:
|
178
206
|
- - "~>"
|
179
207
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0.
|
208
|
+
version: 0.35.0
|
181
209
|
- !ruby/object:Gem::Dependency
|
182
210
|
name: rubocop-packaging
|
183
211
|
requirement: !ruby/object:Gem::Requirement
|
@@ -256,6 +284,7 @@ homepage: https://github.com/ActsAsParanoid/acts_as_paranoid
|
|
256
284
|
licenses:
|
257
285
|
- MIT
|
258
286
|
metadata:
|
287
|
+
changelog_uri: https://github.com/ActsAsParanoid/acts_as_paranoid/blob/master/CHANGELOG.md
|
259
288
|
rubygems_mfa_required: 'true'
|
260
289
|
post_install_message:
|
261
290
|
rdoc_options: []
|
@@ -265,14 +294,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
265
294
|
requirements:
|
266
295
|
- - ">="
|
267
296
|
- !ruby/object:Gem::Version
|
268
|
-
version:
|
297
|
+
version: 3.0.0
|
269
298
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
270
299
|
requirements:
|
271
300
|
- - ">="
|
272
301
|
- !ruby/object:Gem::Version
|
273
302
|
version: '0'
|
274
303
|
requirements: []
|
275
|
-
rubygems_version: 3.
|
304
|
+
rubygems_version: 3.5.16
|
276
305
|
signing_key:
|
277
306
|
specification_version: 4
|
278
307
|
summary: Active Record plugin which allows you to hide and restore records without
|