activeaudit 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/active_audit/logger.rb +7 -9
  2. metadata +2 -2
@@ -17,18 +17,16 @@ module ActiveAudit
17
17
  attr_accessor :audit_user_id
18
18
  attr_accessor :audit_extras
19
19
 
20
- @@_loggable_events = {}
21
-
22
- def self.loggable_event(event)
23
- @@_loggable_events.merge! event
20
+ cattr_accessor :loggable_events do
21
+ {}
24
22
  end
25
23
 
26
- def self.loggable_events
27
- @@_loggable_events
24
+ def self.loggable_event(event)
25
+ self.loggable_events.merge! event
28
26
  end
29
27
 
30
28
  def log_activity_on_create
31
- @@_loggable_events.each do |k,v|
29
+ self.class.loggable_events.each do |k,v|
32
30
  next unless k.eql?(:create)
33
31
  if v.eql?(true)
34
32
  ActiveAudit::Audit.create obj_id: id, obj_type: self.class.to_s, user_id: audit_user_id, activity: k.to_s, extras: audit_extras
@@ -50,7 +48,7 @@ module ActiveAudit
50
48
  end
51
49
 
52
50
  def log_activity_on_update
53
- @@_loggable_events.each do |k,v|
51
+ self.class.loggable_events.each do |k,v|
54
52
  next if [:create,:destroy].include?(k)
55
53
  if k.eql?(:update) and v.eql?(true)
56
54
  ActiveAudit::Audit.create obj_id: id, obj_type: self.class.to_s, user_id: audit_user_id, activity: k.to_s, extras: audit_extras
@@ -74,7 +72,7 @@ module ActiveAudit
74
72
  end
75
73
 
76
74
  def log_activity_on_destroy
77
- @@_loggable_events.each do |k,v|
75
+ self.class.loggable_events.each do |k,v|
78
76
  next unless k.eql?(:destroy)
79
77
  ActiveAudit::Audit.create obj_id: id, obj_type: self.class.to_s, user_id: audit_user_id, activity: k.to_s, extras: audit_extras
80
78
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeaudit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -158,7 +158,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
158
158
  version: '0'
159
159
  segments:
160
160
  - 0
161
- hash: 1962650347525140061
161
+ hash: -2222965222075044048
162
162
  required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  none: false
164
164
  requirements: