permanent_records 4.1.3 → 4.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/permanent_records.rb +7 -5
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49020cd96e9adb3b33db9b45d02ff09441a52d9a
|
4
|
+
data.tar.gz: 2facf318da8c1e7db6bd5f059d1331c9f4f00c4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d4c920908684f981f021a1111692d455223006289f373fe8510e7300dafe5cb215a879599a1f961aeba0a3c2d58aecd2dfbe30a11d922b017473052dbacb8ff
|
7
|
+
data.tar.gz: e03b31b561185e27dba6b093297ba8d829dfcdd8b4fd0f640117f80a043b5c6d8b62b121f2ebc6e305785a2dc84fbae8b7d362438366caade79acd8b5169fcc3
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.1.
|
1
|
+
4.1.4
|
data/lib/permanent_records.rb
CHANGED
@@ -58,19 +58,21 @@ module PermanentRecords
|
|
58
58
|
|
59
59
|
private
|
60
60
|
|
61
|
-
def revival
|
61
|
+
def revival # rubocop:disable Metrics/MethodLength
|
62
62
|
[
|
63
63
|
lambda do |validate|
|
64
64
|
revive_destroyed_dependent_records(validate)
|
65
65
|
end,
|
66
66
|
lambda do |validate|
|
67
|
-
run_callbacks(:revive)
|
67
|
+
run_callbacks(:revive) do
|
68
|
+
set_deleted_at(nil, validate)
|
69
|
+
true
|
70
|
+
end
|
68
71
|
end
|
69
72
|
]
|
70
73
|
end
|
71
74
|
|
72
|
-
# rubocop:disable Style/AccessorMethodName
|
73
|
-
def get_deleted_record
|
75
|
+
def get_deleted_record # rubocop:disable Style/AccessorMethodName
|
74
76
|
# Looking for parent on STI case
|
75
77
|
if respond_to?(:parent_id) && parent_id.present?
|
76
78
|
self.class.unscoped.find(parent_id)
|
@@ -161,7 +163,7 @@ module PermanentRecords
|
|
161
163
|
PermanentRecords.dependent_reflections(self.class)
|
162
164
|
.reduce({}) do |records, (key, _)|
|
163
165
|
found = Array(send(key)).compact
|
164
|
-
next records
|
166
|
+
next records if found.empty?
|
165
167
|
records.update found.first.class => found.map(&:id)
|
166
168
|
end
|
167
169
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: permanent_records
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jack Danger Canty
|
@@ -15,7 +15,7 @@ authors:
|
|
15
15
|
autorequire:
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
|
-
date: 2016-
|
18
|
+
date: 2016-04-08 00:00:00.000000000 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: activerecord
|
@@ -176,4 +176,3 @@ signing_key:
|
|
176
176
|
specification_version: 4
|
177
177
|
summary: Soft-delete your ActiveRecord records
|
178
178
|
test_files: []
|
179
|
-
has_rdoc:
|