soft_deletion 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/soft_deletion/core.rb +3 -18
- data/lib/soft_deletion/version.rb +1 -1
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb38e89312439df81fdb57dd5be332d8e23f1daea98e0bc6433ae3970ae25d2f
|
4
|
+
data.tar.gz: 60086929f21fbb26f458b4621bfd80623b64b9235a48d3c95ed4ef7931d4f6af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d91633a4a6a91922464990c2afbbd5900ac0fc37c9318cc82627fb4b3b7907b6ffe69c12846ec1743b08ebf681b08afe5da09c021ece62e973a8959bee3d6237
|
7
|
+
data.tar.gz: 748dace888a26d27f1ef87a1b9376c5cff7572f5ce191c453c0429d99c9962978cdc1bcccd0d093074b0ee619ef6d9af12cf1b21f17a55c03a9017405950deaf
|
data/lib/soft_deletion/core.rb
CHANGED
@@ -38,19 +38,11 @@ module SoftDeletion
|
|
38
38
|
models = ids_or_models
|
39
39
|
else
|
40
40
|
ids = ids_or_models
|
41
|
-
models =
|
42
|
-
where(:id => ids)
|
43
|
-
else
|
44
|
-
all(:conditions => { :id => ids })
|
45
|
-
end
|
41
|
+
models = where(:id => ids)
|
46
42
|
end
|
47
43
|
|
48
44
|
transaction do
|
49
|
-
|
50
|
-
where(:id => ids).update_all(mark_as_soft_deleted_sql)
|
51
|
-
else
|
52
|
-
update_all(mark_as_soft_deleted_sql, :id => ids)
|
53
|
-
end
|
45
|
+
where(:id => ids).update_all(mark_as_soft_deleted_sql)
|
54
46
|
|
55
47
|
models.each do |model|
|
56
48
|
model.soft_delete_dependencies.each { |dep| dep.execute_soft_delete(:soft_delete!, []) }
|
@@ -94,16 +86,9 @@ module SoftDeletion
|
|
94
86
|
|
95
87
|
protected
|
96
88
|
|
97
|
-
if ActiveRecord::VERSION::MAJOR < 4
|
98
|
-
def each_counter_cached_associations
|
99
|
-
reflections.each do |name, reflection|
|
100
|
-
yield association(name.to_sym) if reflection.belongs_to? && reflection.counter_cache_column
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
89
|
def update_soft_delete_counter_caches(value)
|
106
90
|
each_counter_cached_associations do |association|
|
91
|
+
association.load_target unless association.loaded?
|
107
92
|
if association.target
|
108
93
|
target = association.target
|
109
94
|
target.class.update_counters(target.id, association.reflection.counter_cache_column => value)
|
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.4.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: 2019-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.2.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 6.
|
22
|
+
version: 6.1.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 4.2.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 6.
|
32
|
+
version: 6.1.0
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rake
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,15 +166,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
166
166
|
requirements:
|
167
167
|
- - ">="
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
-
version: 2.
|
169
|
+
version: 2.4.0
|
170
170
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
171
|
requirements:
|
172
172
|
- - ">="
|
173
173
|
- !ruby/object:Gem::Version
|
174
174
|
version: '0'
|
175
175
|
requirements: []
|
176
|
-
|
177
|
-
rubygems_version: 2.7.6
|
176
|
+
rubygems_version: 3.0.3
|
178
177
|
signing_key:
|
179
178
|
specification_version: 4
|
180
179
|
summary: Explicit soft deletion for ActiveRecord via deleted_at and default scope.
|