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



34
35
36
# File 'app/models/audit_rails/audit.rb', line 34

def self.analysis_by_page_views
  group_by_controller_action.count
end

.analysis_by_user_nameObject



30
31
32
# File 'app/models/audit_rails/audit.rb', line 30

def self.analysis_by_user_name
  group_by_user_name.count
end

.needs_attr_accessible?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'app/models/audit_rails/audit.rb', line 3

def self.needs_attr_accessible?
  Rails::VERSION::MAJOR == 3
end

.no_audit_entry_for_today?(action_name, user_name) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
# File 'app/models/audit_rails/audit.rb', line 23

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