paper_trail 2.2.0 → 2.2.1
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.
- data/README.md +0 -6
- data/lib/paper_trail.rb +4 -2
- data/lib/paper_trail/controller.rb +11 -4
- data/lib/paper_trail/version_number.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
# Extended
|
2
|
-
|
3
|
-
Added the possibility to disable/enable PaperTrail from a controller.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
1
|
# PaperTrail
|
8
2
|
|
9
3
|
PaperTrail lets you track changes to your models' data. It's good for auditing or versioning. You can see how a model looked at any stage in its lifecycle, revert it to any version, and even undelete it after it's been destroyed.
|
data/lib/paper_trail.rb
CHANGED
@@ -20,12 +20,14 @@ module PaperTrail
|
|
20
20
|
!!PaperTrail.config.enabled
|
21
21
|
end
|
22
22
|
|
23
|
-
# Returns `true` if PaperTrail is enabled for the
|
23
|
+
# Returns `true` if PaperTrail is enabled for the request, `false` otherwise.
|
24
|
+
#
|
25
|
+
# See `PaperTrail::Controller#paper_trail_enabled_for_controller`.
|
24
26
|
def self.enabled_for_controller?
|
25
27
|
!!paper_trail_store[:request_enabled_for_controller]
|
26
28
|
end
|
27
29
|
|
28
|
-
# Sets
|
30
|
+
# Sets whether PaperTrail is enabled or disabled for the current request.
|
29
31
|
def self.enabled_for_controller=(value)
|
30
32
|
paper_trail_store[:request_enabled_for_controller] = value
|
31
33
|
end
|
@@ -39,13 +39,20 @@ module PaperTrail
|
|
39
39
|
{}
|
40
40
|
end
|
41
41
|
|
42
|
+
# Returns `true` (default) or `false` depending on whether PaperTrail should
|
43
|
+
# be active for the current request.
|
44
|
+
#
|
45
|
+
# Override this method in your controller to specify when PaperTrail should
|
46
|
+
# be off.
|
47
|
+
def paper_trail_enabled_for_controller
|
48
|
+
true
|
49
|
+
end
|
50
|
+
|
42
51
|
private
|
43
52
|
|
44
|
-
# Tells PaperTrail
|
53
|
+
# Tells PaperTrail whether versions should be saved in the current request.
|
45
54
|
def set_paper_trail_enabled_for_controller
|
46
|
-
|
47
|
-
::PaperTrail.enabled_for_controller = paper_trail_enabled_for_controller
|
48
|
-
end
|
55
|
+
::PaperTrail.enabled_for_controller = paper_trail_enabled_for_controller
|
49
56
|
end
|
50
57
|
|
51
58
|
# Tells PaperTrail who is responsible for any changes that occur.
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paper_trail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 2.2.
|
9
|
+
- 1
|
10
|
+
version: 2.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andy Stewart
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-06 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|