1
0
Fork 0
mirror of https://github.com/paper-trail-gem/paper_trail.git synced 2022-11-09 11:33:19 -05:00
paper-trail-gem--paper_trail/lib/paper_trail.rb

30 lines
515 B
Ruby
Raw Normal View History

2009-05-27 11:21:20 -04:00
require 'yaml'
require 'paper_trail/has_paper_trail'
require 'paper_trail/version'
module PaperTrail
@@whodunnit = nil
def self.included(base)
base.before_filter :set_whodunnit
end
def self.whodunnit
@@whodunnit.respond_to?(:call) ? @@whodunnit.call : @@whodunnit
end
def self.whodunnit=(value)
@@whodunnit = value
end
private
def set_whodunnit
@@whodunnit = lambda {
self.send :current_user rescue nil
2009-05-27 11:21:20 -04:00
}
end
end
ActionController::Base.send :include, PaperTrail