Class: AuditLog::LogsController

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

Instance Method Summary collapse

Instance Method Details

#indexObject



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

def index
  @logs = Log.order('id desc').includes(:user)
  @logs = @logs.where('action like ?', "%#{params[:q]}%") if params[:q].present?
  @logs = @logs.where("action = ?", params[:action_type]) if params[:action_type].present?
  @logs = @logs.where("created_at >= ?", Time.parse(params[:start_time])) if params[:start_time].present?
  @logs = @logs.where("created_at < ?", Time.parse(params[:end_time])) if params[:end_time].present?
  @logs = @logs.page(params[:page]).per(15)
end

#showObject



17
# File 'app/controllers/audit_log/logs_controller.rb', line 17

def show; end