soft_deletion 1.9.0 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +1 -0
- data/lib/soft_deletion/core.rb +18 -7
- data/lib/soft_deletion/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa304747a0e4749f973d98933fde9fd02fecc120f058dedba835ae68920d7b95
|
4
|
+
data.tar.gz: c21df829755fe43cc19272fe307d32c5a0b62b5e8aa9148e2fd511d23b5532b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f07e9ae9e39905458c04cd71a28be75b0f7f1dc9abce4d169adab2ed635f42b598e3b5f4677d46a42cade1f858f83baa1edc28b746e765e3c1d7fd99a88d8192
|
7
|
+
data.tar.gz: 9a4ddb8f61ba8f5cf4de6a0478e1cc12ec088cf6c8a61d2d1c71052f2aee5e1ea9fd674d5933457c2c03abddfb74f4963c5a1dd77ee9921b7a2423f6e5707c2e
|
data/Readme.md
CHANGED
@@ -62,6 +62,7 @@ Authors
|
|
62
62
|
- [Oliver Nightingale](https://github.com/olivernn)
|
63
63
|
- [Kumar Pandya](https://github.com/kpandya91)
|
64
64
|
- [Alex Pauly](https://github.com/apauly)
|
65
|
+
- [Yaroslav](https://github.com/viralpraxis)
|
65
66
|
|
66
67
|
[Zendesk](http://zendesk.com)<br/>
|
67
68
|
michael@grosser.it<br/>
|
data/lib/soft_deletion/core.rb
CHANGED
@@ -86,14 +86,25 @@ module SoftDeletion
|
|
86
86
|
|
87
87
|
protected
|
88
88
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
target = association.target
|
94
|
-
target.class.update_counters(target.id, association.reflection.counter_cache_column => value)
|
89
|
+
if ActiveRecord.version >= Gem::Version.new("7.2.0")
|
90
|
+
def update_soft_delete_counter_caches(value) # uncovered NOTE: covered only at Rails >= 7.2.0 tests
|
91
|
+
counter_cached_association_names.each do |association_name| # uncovered
|
92
|
+
update_soft_delete_counter_cache(association(association_name), value) # uncovered
|
95
93
|
end
|
96
94
|
end
|
95
|
+
else
|
96
|
+
def update_soft_delete_counter_caches(value) # uncovered NOTE: covered only at Rails < 7.2.0 tests
|
97
|
+
each_counter_cached_associations do |association| # uncovered
|
98
|
+
update_soft_delete_counter_cache(association, value) # uncovered
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def update_soft_delete_counter_cache(association, value)
|
104
|
+
association.load_target unless association.loaded?
|
105
|
+
if (target = association.target) # uncovered TODO: add test coverage for target not existing
|
106
|
+
target.class.update_counters(target.id, association.reflection.counter_cache_column => value)
|
107
|
+
end
|
97
108
|
end
|
98
109
|
|
99
110
|
def _run_soft_delete(method, *args, **kwargs, &block)
|
@@ -115,7 +126,7 @@ module SoftDeletion
|
|
115
126
|
end
|
116
127
|
|
117
128
|
def _run_soft_undelete(&block)
|
118
|
-
raise "#{self.class} is not deleted" unless deleted_at
|
129
|
+
raise "#{self.class} is not deleted" unless deleted_at # uncovered TODO: add test coverage
|
119
130
|
|
120
131
|
result = false
|
121
132
|
limit = deleted_at - 1.hour
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soft_deletion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: 5.0.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '8.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: 5.0.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '8.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rake
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
159
159
|
- !ruby/object:Gem::Version
|
160
160
|
version: '0'
|
161
161
|
requirements: []
|
162
|
-
rubygems_version: 3.
|
162
|
+
rubygems_version: 3.4.10
|
163
163
|
signing_key:
|
164
164
|
specification_version: 4
|
165
165
|
summary: Explicit soft deletion for ActiveRecord via deleted_at and default scope.
|