paper_trail 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
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 controller, `false` otherwise.
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 if PaperTrails is disabled by controller
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 if version should be saved.
53
+ # Tells PaperTrail whether versions should be saved in the current request.
45
54
  def set_paper_trail_enabled_for_controller
46
- if respond_to? :paper_trail_enabled_for_controller
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.
@@ -1,3 +1,3 @@
1
1
  module PaperTrail
2
- VERSION = '2.2.0'
2
+ VERSION = '2.2.1'
3
3
  end
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: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 2
9
- - 0
10
- version: 2.2.0
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-05 00:00:00 +01:00
18
+ date: 2011-04-06 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency