Class: Log
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Log
- Defined in:
- lib/models/log.rb
Overview
The Log object represents a log line of a Bind’s query
Class Method Summary collapse
-
.last_queries ⇒ Object
Shows last 30 queries.
-
.top_clients ⇒ Object
Shows 50 top clients.
-
.top_queries ⇒ Object
Shows 50 top queries.
Class Method Details
.last_queries ⇒ Object
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_clients ⇒ Object
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_queries ⇒ Object
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 |