Class: AuditsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/generators/auditing/templates/audits_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



3
4
5
6
7
# File 'lib/generators/auditing/templates/audits_controller.rb', line 3

def index
  resource  = params[:resource].classify.constantize
  @resource = resource.find(params[:id])
  @audits   = @resource.audits
end

#rollbackObject



9
10
11
12
13
14
15
# File 'lib/generators/auditing/templates/audits_controller.rb', line 9

def rollback
  audit = Audit.find(params[:id])
  audit.rollback
  
  resource = audit.auditable
  redirect_to audits_path(resource.class.table_name, resource)
end