jeremyw-paper_trail 1.2.9 → 1.2.10

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.9
1
+ 1.2.10
data/lib/paper_trail.rb CHANGED
@@ -1,8 +1,11 @@
1
1
  require 'yaml'
2
2
  require 'paper_trail/has_paper_trail'
3
3
  require 'paper_trail/version'
4
+ mattr_accessor :disabled
5
+
4
6
 
5
7
  module PaperTrail
8
+ mattr_accessor :disabled
6
9
  @@whodunnit = nil
7
10
 
8
11
  def self.included(base)
@@ -32,11 +32,11 @@ module PaperTrail
32
32
  module InstanceMethods
33
33
  def record_create
34
34
  versions.create(:event => 'create',
35
- :whodunnit => PaperTrail.whodunnit) if self.class.paper_trail_active
35
+ :whodunnit => PaperTrail.whodunnit) if self.class.paper_trail_active && !PaperTrail.disabled
36
36
  end
37
37
 
38
38
  def record_update
39
- if changed? and self.class.paper_trail_active
39
+ if changed? and self.class.paper_trail_active and !PaperTrail.disabled
40
40
  versions.build :event => 'update',
41
41
  :object => object_to_string(previous_version),
42
42
  :whodunnit => PaperTrail.whodunnit
@@ -46,7 +46,7 @@ module PaperTrail
46
46
  def record_destroy
47
47
  versions.create(:event => 'destroy',
48
48
  :object => object_to_string(previous_version),
49
- :whodunnit => PaperTrail.whodunnit) if self.class.paper_trail_active
49
+ :whodunnit => PaperTrail.whodunnit) if self.class.paper_trail_active && !PaperTrail.disabled
50
50
  end
51
51
 
52
52
  # Returns the object at the version that was valid at the given timestamp.
data/paper_trail.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{paper_trail}
5
- s.version = "1.2.9"
5
+ s.version = "1.2.10"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Andy Stewart", "Jeremy Weiskotten", "Joe Lind"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jeremyw-paper_trail
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.9
4
+ version: 1.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Stewart