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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 595f5caa02178adb3db5785bcfef5d4a73e78a88
4
- data.tar.gz: eabee8ff00bb0486fa1a15dbc612d5fa10428c58
3
+ metadata.gz: 7eba691d11ba549876d3544724ce5401b019a66d
4
+ data.tar.gz: ff3b2daa27f79b3ad97489a4ae71753d7d177427
5
5
  SHA512:
6
- metadata.gz: 1dd3e5725593a637a3d25d2af1abd15bdc7bd0c80de1afb6b5c441f85b75ea36b8619884499698d54345de6db9e938fab957fc1ed4b162563a1287a18e98b867
7
- data.tar.gz: 771edf6eb0a1763dfd00955ccbcbf0ef8221c6018a8028e8d5cff1c8ffe4ddcda47ef4f2d38f7f64a09312fea7a0c4deae772867e8b60664d9f9781d429c11b9
6
+ metadata.gz: 8080212e0e08f1036e7d29104d6277929883a215c58f51e7d87b6c4bef3f3c65121a2ccfa598277f7c15bdbe4d44debc4710777fd0c870bfe04cbf00280cbb59
7
+ data.tar.gz: e0b7093ff68586caa5c369314344e130d59c3d66b081a66412d76385d773ec1db9d35b4760dbdbaf9f1cd6bcf7d2bd6a7d58dd176cb6c0533df1f285d1712987
data/README.md CHANGED
@@ -2,19 +2,22 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/matheus208/mongoid-pending_changes.svg?branch=master)](https://travis-ci.org/matheus208/mongoid-pending_changes)
4
4
 
5
- version 0.1.0
5
+ [![Gem Version](https://badge.fury.io/rb/mongoid-pending_changes.svg)](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
- ```ruby
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 += 1
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
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module PendingChanges
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
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.0
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: 2015-12-11 00:00:00.000000000 Z
11
+ date: 2016-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler