activeaudit 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  Audit support for Active Record
4
4
 
5
5
  [![Build Status](https://travis-ci.org/maintux/activeaudit.png)](https://travis-ci.org/maintux/activeaudit)
6
+ [![Code Climate](https://codeclimate.com/github/maintux/activeaudit.png)](https://codeclimate.com/github/maintux/activeaudit)
6
7
 
7
8
  ## Install
8
9
 
@@ -4,7 +4,9 @@ class ActiveAudit::Audit < ActiveRecord::Base
4
4
  validates_presence_of :obj_id, :obj_type, :activity
5
5
 
6
6
  if defined?(::Rails)
7
- ::ActiveAudit::AuditConcern
7
+ if File.exists?(File.join(Rails.root.to_s,'app','concerns','active_audit','audit_concern.rb'))
8
+ require File.join(Rails.root.to_s,'app','concerns','active_audit','audit_concern.rb')
9
+ end
8
10
  if defined?(::ActiveAudit::AuditConcern)
9
11
  include ::ActiveAudit::AuditConcern
10
12
  end
@@ -34,15 +34,9 @@ module ActiveAudit
34
34
  v.each do |field|
35
35
  if field.is_a?(Hash)
36
36
  key, value = field.first
37
- if self.send(key.to_s).eql?(value)
38
- log_event = true
39
- break
40
- end
37
+ log_event = true and break if self.send(key.to_s).eql?(value)
41
38
  elsif field.is_a?(Symbol)
42
- if self.send(field.to_s)
43
- log_event = true
44
- break
45
- end
39
+ log_event and break if self.send(field.to_s)
46
40
  end
47
41
  end
48
42
  if log_event
@@ -63,15 +57,9 @@ module ActiveAudit
63
57
  v.each do |field|
64
58
  if field.is_a?(Hash)
65
59
  key, value = field.first
66
- if self.send("#{key}_changed?") and self.send(key.to_s).eql?(value)
67
- log_event = true
68
- break
69
- end
60
+ log_event = true and break if self.send("#{key}_changed?") and self.send(key.to_s).eql?(value)
70
61
  elsif field.is_a?(Symbol)
71
- if self.send("#{field}_changed?")
72
- log_event = true
73
- break
74
- end
62
+ log_event = true and break if self.send("#{field}_changed?")
75
63
  end
76
64
  end
77
65
  if log_event
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.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-26 00:00:00.000000000 Z
12
+ date: 2013-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc
@@ -157,7 +157,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
157
  version: '0'
158
158
  segments:
159
159
  - 0
160
- hash: 4479424809207949742
160
+ hash: 1655834409146066276
161
161
  required_rubygems_version: !ruby/object:Gem::Requirement
162
162
  none: false
163
163
  requirements: