mongoid-pending_changes 0.1.0 → 0.1.2
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/README.md +7 -4
- data/lib/mongoid/pending_changes/pending_changes.rb +2 -1
- data/lib/mongoid/pending_changes/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7eba691d11ba549876d3544724ce5401b019a66d
|
4
|
+
data.tar.gz: ff3b2daa27f79b3ad97489a4ae71753d7d177427
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8080212e0e08f1036e7d29104d6277929883a215c58f51e7d87b6c4bef3f3c65121a2ccfa598277f7c15bdbe4d44debc4710777fd0c870bfe04cbf00280cbb59
|
7
|
+
data.tar.gz: e0b7093ff68586caa5c369314344e130d59c3d66b081a66412d76385d773ec1db9d35b4760dbdbaf9f1cd6bcf7d2bd6a7d58dd176cb6c0533df1f285d1712987
|
data/README.md
CHANGED
@@ -2,19 +2,22 @@
|
|
2
2
|
|
3
3
|
[](https://travis-ci.org/matheus208/mongoid-pending_changes)
|
4
4
|
|
5
|
-
|
5
|
+
[](https://badge.fury.io/rb/mongoid-pending_changes)
|
6
6
|
|
7
7
|
Mongoid::PendingChanges adds an option to keep further changes from modifying the record, pushing them to a changelist instead.
|
8
8
|
|
9
9
|
This is an initial effort to develop an approval system to control changes to collections.
|
10
10
|
|
11
|
+
## Change Log
|
12
|
+
|
13
|
+
v0.1.2:
|
14
|
+
Fixing a bug where records created before the gem was used would cause an exception due to the required fields being nil.
|
15
|
+
|
11
16
|
## Installation
|
12
17
|
|
13
18
|
Add this line to your application's Gemfile:
|
14
19
|
|
15
|
-
|
16
|
-
gem 'mongoid-pending_changes'
|
17
|
-
```
|
20
|
+
gem 'mongoid-pending_changes'
|
18
21
|
|
19
22
|
And then execute:
|
20
23
|
|
@@ -20,13 +20,14 @@ module Mongoid
|
|
20
20
|
|
21
21
|
def push_for_approval(changes, meta = {})
|
22
22
|
#TODO Think of multithreading?
|
23
|
-
self.last_version
|
23
|
+
self.last_version = (self.last_version || 0) + 1
|
24
24
|
|
25
25
|
version = meta.merge number: self.last_version,
|
26
26
|
data: changes,
|
27
27
|
time: Time.now,
|
28
28
|
approved: false
|
29
29
|
|
30
|
+
self.changelist = [] unless self.changelist
|
30
31
|
self.changelist.push version
|
31
32
|
|
32
33
|
self.save
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid-pending_changes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- matheus208
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|