Sha256: 4fb47ec1baccb495abf8c50207befd7262e1a5d0ef1fd71fa683377029f136d0

Contents?: true

Size: 571 Bytes

Versions: 1

Compression:

Stored size: 571 Bytes

Contents

require 'yaml'
require 'paper_trail/has_paper_trail'
require 'paper_trail/version'
mattr_accessor :disabled


module PaperTrail
  mattr_accessor :disabled
  @@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
    }
  end
  
end

ActionController::Base.send :include, PaperTrail

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jeremyw-paper_trail-1.2.10 lib/paper_trail.rb