Sha256: a9dd60c7272546d3af066c76deeae9186641a70c4c78e408bf5001d1528c9724

Contents?: true

Size: 515 Bytes

Versions: 3

Compression:

Stored size: 515 Bytes

Contents

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
    }
  end
end

ActionController::Base.send :include, PaperTrail

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
paper_trail-1.4.1 lib/paper_trail.rb
paper_trail-1.4.0 lib/paper_trail.rb
paper_trail-1.3.1 lib/paper_trail.rb