Class: AuditRails::Audit
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- AuditRails::Audit
- Defined in:
- app/models/audit_rails/audit.rb
Class Method Summary collapse
- .analysis_by_page_views ⇒ Object
- .analysis_by_user_name ⇒ Object
- .needs_attr_accessible? ⇒ Boolean
- .no_audit_entry_for_today?(action_name, user_name) ⇒ Boolean
- .unique_visitor_count ⇒ Object
- .visitor_count ⇒ Object
Class Method Details
.analysis_by_page_views ⇒ Object
35 36 37 |
# File 'app/models/audit_rails/audit.rb', line 35 def self.analysis_by_page_views group_by_controller_action.count.map{|k,v| {'page' => k.join('/'), 'count' => v}}.to_json end |
.analysis_by_user_name ⇒ Object
31 32 33 |
# File 'app/models/audit_rails/audit.rb', line 31 def self.analysis_by_user_name group_by_user_name.count.map{|k,v| {'user' => k, 'count' => v}}.to_json end |
.needs_attr_accessible? ⇒ 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
24 25 26 27 28 29 |
# File 'app/models/audit_rails/audit.rb', line 24 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 |
.unique_visitor_count ⇒ Object
39 40 41 |
# File 'app/models/audit_rails/audit.rb', line 39 def self.unique_visitor_count group_by_ip_address.count.values.size end |
.visitor_count ⇒ Object
43 44 45 |
# File 'app/models/audit_rails/audit.rb', line 43 def self.visitor_count group_by_ip_address.count.values.sum end |