mongoid-archivable 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 921a26dc194f7addd2eaff0e4f094f86962a44e5
|
4
|
+
data.tar.gz: 66c9c7d076d1488661ea55ea7e1c60d97713f7bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cee5339dcbbc3861ab1c9335009d95dd82cfeec196a2c439b8fb071895383f301b7376e1556b988ae54ce9414d07d53da7591ebfc70319330cba280d5efed994
|
7
|
+
data.tar.gz: 92e3a9d9687e44c1bc8ef5b9ad02fe7bfb44286f6ce3a8c13604ebfc6df269cf9d4f39ae88e90b41d2ea89c72bb13ae8d0acdc6ac8a2773b0cf3cf1639c5bb45
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
# 1.7.0
|
2
|
+
|
3
|
+
* `restore` returns nil if save unsuccessful, [#14](https://github.com/Sign2Pay/mongoid-archivable/pull/14)
|
4
|
+
* added `restore!` method, [#14](https://github.com/Sign2Pay/mongoid-archivable/pull/14)
|
5
|
+
* updated `ProcessLocalizedFields` to correctly restore embedded polymorphic relations, [#13](https://github.com/Sign2Pay/mongoid-archivable/pull/13)
|
6
|
+
|
7
|
+
# 1.6.0
|
8
|
+
|
9
|
+
* Support different database or client for archived documents, [#12](https://github.com/Sign2Pay/mongoid-archivable/pull/12), thanks to [@jackbit](https://github.com/jackbit)
|
10
|
+
|
1
11
|
# 1.5.2
|
2
12
|
|
3
13
|
* correctly restore localized fields on self and embedded documents
|
@@ -17,15 +17,16 @@ module Mongoid
|
|
17
17
|
|
18
18
|
embedded_relations.each do |relation|
|
19
19
|
relation_name = relation.name.to_s
|
20
|
-
relation_class = relation.class_name.constantize
|
21
20
|
|
22
21
|
# convert embeds_many
|
23
22
|
if attrs[relation_name].is_a?(Array)
|
24
23
|
attrs[relation_name] = attrs[relation_name].map do |att|
|
24
|
+
relation_class = att.fetch('_type', relation.class_name).constantize
|
25
25
|
ProcessLocalizedFields.call(relation_class, att)
|
26
26
|
end
|
27
27
|
# convert embeds_one
|
28
28
|
elsif att = attrs[relation_name]
|
29
|
+
relation_class = att.fetch('_type', relation.class_name).constantize
|
29
30
|
attrs[relation_name] = ProcessLocalizedFields.call(relation_class, att)
|
30
31
|
end
|
31
32
|
end
|
@@ -3,7 +3,13 @@ module Mongoid
|
|
3
3
|
module Restoration
|
4
4
|
# Restores the archived document to its former glory.
|
5
5
|
def restore
|
6
|
-
original_document.save
|
6
|
+
if original_document.save
|
7
|
+
original_document
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def restore!
|
12
|
+
original_document.save!
|
7
13
|
original_document
|
8
14
|
end
|
9
15
|
|
@@ -35,4 +41,4 @@ module Mongoid
|
|
35
41
|
end
|
36
42
|
end
|
37
43
|
end
|
38
|
-
end
|
44
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-archivable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joost Baaij
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|