Sha256: 11cc9e64d1ce6b8120ea128b65a07084ba40da7f0a007078132b5af6f0ec2ae4
Contents?: true
Size: 977 Bytes
Versions: 1
Compression:
Stored size: 977 Bytes
Contents
module AuditRails class Audit < ActiveRecord::Base def self.needs_attr_accessible? Rails::VERSION::MAJOR == 3 end if needs_attr_accessible? attr_accessible :action, :controller, :description, :user_name end # Supports both string and date format of range given scope :in_range, ->(range_begin, range_end){ if range_end.blank? || range_end.blank? range_begin, range_end = '1970-01-01', Time.now end where(created_at: range_begin.to_date.beginning_of_day..range_end.to_date.end_of_day) } 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 def self.analysis_by_user_name count(group: 'user_name') end def self.analysis_by_page_views count(group: 'controller,action') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
audit_rails-1.1.7 | app/models/audit_rails/audit.rb |