Allow searching in logs view

This commit is contained in:
Christoph Haas 2016-08-24 22:41:31 +02:00
parent c467e0ef23
commit 10d5bab37c
2 changed files with 12 additions and 4 deletions

View file

@ -2,6 +2,13 @@ class LogsController < ApplicationController
before_action :authenticate_user!
def index
@logs = Log.paginate(page: params[:page], per_page: 20)
logs = Log
if params[:search].present?
logger.debug "Searching for #{params[:search]}"
logs = logs.where("message ilike ?", "%#{params[:search]}%")
end
@logs = logs.paginate(page: params[:page], per_page: 20)
end
end