Class: Admin::LogsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/admin/logs_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



8
9
10
11
12
13
14
15
# File 'app/controllers/admin/logs_controller.rb', line 8

def index
  @datatable = EffectiveLogsDatatable.new(self)

  @page_title = 'Logs'

  EffectiveLogging.authorize!(self, :index, Effective::Log)
  EffectiveLogging.authorize!(self, :admin, :effective_logging)
end

#showObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/admin/logs_controller.rb', line 17

def show
  @log = Effective::Log.includes(:logs).find(params[:id])
  @log.next_log = Effective::Log.order(:id).where(parent_id: @log.parent_id).where('id > ?', @log.id).first
  @log.prev_log = Effective::Log.order(:id).where(parent_id: @log.parent_id).where('id < ?', @log.id).last

  @page_title = "Log ##{@log.to_param}"

  if @log.logs.present?
    @log.datatable = EffectiveLogsDatatable.new(self, log_id: @log.id)
  end

  EffectiveLogging.authorize!(self, :show, @log)
  EffectiveLogging.authorize!(self, :admin, :effective_logging)
end