Sha256: 97b7c40bfe30ee540469964de17779ad1fb120f89662a0cebb6481d4228df452

Contents?: true

Size: 861 Bytes

Versions: 1

Compression:

Stored size: 861 Bytes

Contents

module EffectiveLogging
  module SetCurrentUser
    module ActionController

      # Add me to your ApplicationController
      # before_action :set_effective_logging_current_user

      def set_effective_logging_current_user
        if respond_to?(:current_user)
          EffectiveLogging.current_user = current_user
        else
          raise "(effective_logging) set_effective_logging_current_user expects a current_user() method to be available"
        end
      end

      def set_log_changes_user
        # No longer need to call this
      end

      # Sets the before action it immediately
      def self.included(base)
        if base.respond_to?(:before_action)
          base.before_action :set_effective_logging_current_user
        else
          base.before_filter :set_effective_logging_current_user
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
effective_logging-1.8.1 lib/effective_logging/set_current_user.rb