Class: ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
lib/audited_controller.rb,
app/controllers/application_controller.rb

Overview

-*- encoding : utf-8 -*-

Instance Method Summary collapse

Instance Method Details

#add_to_auditObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/audited_controller.rb', line 9

def add_to_audit
  audit_config = HashWithIndifferentAccess.new(YAML.load(File.read(
    File.expand_path("#{Rails.root}/config/audits.yml", __FILE__))))
  controller = params[:controller]
  action = params[:action]
  request_type = restful_method(params)
  return if !audit_get_request?(audit_config) && request_type == 'get'
  Audit.create!(action: action, controller: controller, user_name: current_user.,
    description: audit_config[controller][action],
    :params => params.inspect,
    remote_ip: request.remote_ip, restful_method: restful_method(params) )
end