lib/paper_trail.rb in jeremyw-paper_trail-1.2.12 vs lib/paper_trail.rb in jeremyw-paper_trail-1.2.14
- old
+ new
@@ -1,25 +1,29 @@
require 'yaml'
+require 'paper_trail/config'
require 'paper_trail/has_paper_trail'
require 'paper_trail/version'
module PaperTrail
- @@enabled = true
@@whodunnit = nil
+ def self.config
+ @@config ||= PaperTrail::Config.instance
+ end
+
def self.included(base)
base.before_filter :set_whodunnit
end
def self.enabled=(value)
- @@enabled = value
+ PaperTrail.config.enabled = value
end
-
+
def self.enabled?
- @@enabled
+ !!PaperTrail.config.enabled
end
-
+
def self.whodunnit
@@whodunnit.respond_to?(:call) ? @@whodunnit.call : @@whodunnit
end
def self.whodunnit=(value)
@@ -31,9 +35,9 @@
def set_whodunnit
@@whodunnit = lambda {
self.send :current_user rescue nil
}
end
-
+
end
ActionController::Base.send :include, PaperTrail