purgatory 0.2.0 → 1.0.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 +8 -8
- data/README.markdown +20 -1
- data/VERSION +1 -1
- data/lib/purgatory/purgatory.rb +11 -0
- data/purgatory.gemspec +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjNiYzA3NTg0YjQzMTQ0ZmE3ZjdmNzcyZWIwOGJiNGRjOGY1M2U3NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWQ0MGZmZDg2ZjhjYmNjNGVkZjhkNTAwMzMxZmM1ZWJkNzdmMTVhYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OGQ3MTIxYjgxYzZiOTNjMDhhNGZjNzRiY2Y3NjQ2NjZhMTMxZjY1ODZhMDA1
|
10
|
+
NzdhNzY3MzQ0MmRmNDYzMTBkMDRlMTBhOTZhZDY5MDQ0NzI1MDIzODAyMWE0
|
11
|
+
ZTAxMmRhNGQ0NmEyZjczNDg5ZjU0MTA5Yzc2M2M3OTg0NzhjNTU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NmM4ZDU3MjIzNDdhMTQ0MGNkNmM1YmVlM2Y4MTYzMjgwNmYyZmYzMDRlNjYw
|
14
|
+
ZjYzNWEzNDViZmEyMjU4YjBmMWFmOTAyZTUwM2Y1MjYwNjM5OTk5NGI4ZDE1
|
15
|
+
ODU5YWZiMjU3MmU0Y2U1MTIxMzdlOWEyYjQxZDA4ZmRkODNhMTQ=
|
data/README.markdown
CHANGED
@@ -24,9 +24,28 @@ To put your changes to an ActiveRecord class into Purgatory, simply make your ch
|
|
24
24
|
|
25
25
|
To apply the changes, simply call the approve! method on the associated Pergatory instance, passing in the approving user as a parameter
|
26
26
|
|
27
|
-
purgatory =
|
27
|
+
purgatory = item.purgatories.last
|
28
28
|
purgatory.approve!(current_user)
|
29
29
|
|
30
|
+
The following are the attributes of a purgatory:
|
31
|
+
|
32
|
+
purgatory.soul # The ActiveRecord model instance whose changes are in purgatory
|
33
|
+
purgatory.requester # The user who created the purgatory
|
34
|
+
purgatory.created_at # The time when the purgatory was created
|
35
|
+
purgatory.approver # The user who approved the purgatory
|
36
|
+
purgatory.approved_at # The time when the purgatory was approved
|
37
|
+
|
38
|
+
Here are some handy scopes and methods available to you:
|
39
|
+
|
40
|
+
### Scopes
|
41
|
+
Purgatory.pending # Returns a relation of all pending purgatories
|
42
|
+
Purgatory.approved # Returns a relation of all approved purgatories
|
43
|
+
|
44
|
+
### Methods
|
45
|
+
purgatory.pending? # Returns true if the purgatory is pending, false otherwise
|
46
|
+
purgatory.approved? # Returns true if the purgatory has been approved, false otherwise
|
47
|
+
purgatory.changes_hash # Returns a hash of the proposed changes. The keys are the attribute names and the values are 2-element arrays where the 1st element is the old value and the 2nd element is the new value
|
48
|
+
|
30
49
|
## Contributing to Purgatory
|
31
50
|
|
32
51
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
1.0.0
|
data/lib/purgatory/purgatory.rb
CHANGED
@@ -8,6 +8,17 @@ class Purgatory < ActiveRecord::Base
|
|
8
8
|
|
9
9
|
validates :soul, :requester, presence: true
|
10
10
|
|
11
|
+
scope :pending, conditions: { approved_at: nil }
|
12
|
+
scope :approved, conditions: ["approved_at IS NOT NULL"]
|
13
|
+
|
14
|
+
def approved?
|
15
|
+
approved_at.present?
|
16
|
+
end
|
17
|
+
|
18
|
+
def pending?
|
19
|
+
approved_at.nil?
|
20
|
+
end
|
21
|
+
|
11
22
|
def changes_hash
|
12
23
|
ActiveSupport::JSON.decode(changes_json)
|
13
24
|
end
|
data/purgatory.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: purgatory 0.
|
5
|
+
# stub: purgatory 1.0.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "purgatory"
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "1.0.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.authors = ["Elan Dubrofsky"]
|