Class: ApplicationController

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

Instance Method Summary collapse

Instance Method Details

#add_to_auditObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/application_controller.rb', line 4

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