Class: Log

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/models/log.rb

Overview

The Log object represents a log line of a Bind’s query

Class Method Summary collapse

Class Method Details

.last_queriesObject

Shows last 30 queries



4
5
6
# File 'lib/models/log.rb', line 4

def self.last_queries
  self.order(date: :desc).limit(30)
end

.top_clientsObject

Shows 50 top clients



14
15
16
# File 'lib/models/log.rb', line 14

def self.top_clients
  self.select('client, count(*) as hits').group(:client).order('hits DESC').limit(50)
end

.top_queriesObject

Shows 50 top queries



9
10
11
# File 'lib/models/log.rb', line 9

def self.top_queries
  self.select('query, count(*) as hits').group(:query).order('hits DESC').limit(50)
end