Class: AuditRails::AuditsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/audit_rails/audits_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#add_to_audit

Instance Method Details

#createObject



19
20
21
22
# File 'app/controllers/audit_rails/audits_controller.rb', line 19

def create
  add_to_audit("visit-site", "xyz", "Fake User")
  render :nothing => true, :status => 200, :content_type => 'text/html'
end

#indexObject



7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/audit_rails/audits_controller.rb', line 7

def index
  @audits = AuditRails::Audit.all
  
  respond_to do |format|
    format.html # index.html.erb
    format.json { render json: @audits }
    format.xls { send_data @audits.to_xls(:columns => [:user_name, :action, :description, :created_at], 
      :headers => ['User name', 'Action', 'Details', 'When?']), filename: 'audits.xls'}

  end
end