Sha256: 74cbd6c39a5c0d5d97e9986adfb328f74c98d014a7c41a2370bcde81c34d7c73
Contents?: true
Size: 751 Bytes
Versions: 3
Compression:
Stored size: 751 Bytes
Contents
module Auditor require 'engine' if defined?(Rails) && Rails::VERSION::MAJOR == 3 require 'application_controller' end module ActionController module Auditor def self.included(base) base.extend(ClassMethods) end module ClassMethods def is_audited include ActionController::Auditor::InstanceMethods before_filter :audit_request end end module InstanceMethods def audit_request a = ::Auditor::AuditorLog.new a.request_uri = request.url a.request_parameters = request.filtered_parameters.inspect a.remote_address = request.remote_ip a.user_id = ::Auditor::Engine::config.user_id.call(request) a.save! end end end end ActionController::Base.send(:include, ActionController::Auditor)
Version data entries
3 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
request-auditor-0.0.3 | lib/auditor.rb |
request-auditor-0.0.3 | lib/request-auditor.rb |
request-auditor-0.0.1 | lib/auditor.rb |