Module: TheAudit::Controller

Extended by:
ActiveSupport::Concern
Included in:
Admin::AuditsController
Defined in:
app/controllers/concerns/controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



32
33
34
35
# File 'app/controllers/concerns/controller.rb', line 32

def destroy
  @audit.destroy
  redirect_to audits_url
end

#editObject



22
# File 'app/controllers/concerns/controller.rb', line 22

def edit; end

#indexObject



9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/concerns/controller.rb', line 9

def index
  @ctrl_acts = Audit
    .audit_scope(params)
    .select('DISTINCT controller_name, action_name, COUNT(*) as count')
    .group('controller_name, action_name')
    .reorder('count DESC').to_a

  @audits_count = Audit.audit_scope(params).count
  @audits = Audit.audit_scope(params).pagination(params)
end

#showObject



20
# File 'app/controllers/concerns/controller.rb', line 20

def show; end

#updateObject



24
25
26
27
28
29
30
# File 'app/controllers/concerns/controller.rb', line 24

def update
  if @audit.update(audit_params)
    redirect_to audit_path(@audit), notice: 'Audit was successfully updated.'
  else
    render action: 'edit'
  end
end