Class: AuditRails::Audit

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/audit_rails/audit.rb

Class Method Summary collapse

Class Method Details

.analysis_by_page_viewsObject



16
17
18
# File 'app/models/audit_rails/audit.rb', line 16

def self.analysis_by_page_views
  count(group: 'controller,action')
end

.analysis_by_user_nameObject



12
13
14
# File 'app/models/audit_rails/audit.rb', line 12

def self.analysis_by_user_name
  count(group: 'user_name')
end

.no_audit_entry_for_today?(action_name, user_name) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
# File 'app/models/audit_rails/audit.rb', line 5

def self.no_audit_entry_for_today?(action_name, user_name)
  audits = where(action: action_name, user_name: user_name, 
    created_at: Time.now.to_date.beginning_of_day..Time.now.to_date.end_of_day)
  
  audits.blank?
end