active_audit 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16454d4e21b0bc4feabfa1858dffbd5496b1646e
|
4
|
+
data.tar.gz: b9a1a01b0043f15a57d4f65b22a466e1c591ce0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e01a7fd05d2190fb7e84e3815c140b99f1fc17b09d8a9b20fcef43cd7d2f851e1681ba9368b5183a7f74f58ae976e8b7fc9ce02b8e24ac223126c2a5044d36e5
|
7
|
+
data.tar.gz: 992f963db94957563412673198e951e2fefa4d9af52741923120b5c14392b85906d70f212b987665e72c5d01b2d5b51fb4fc678e533b9e476c62ae07c2e48127
|
data/lib/active_audit/version.rb
CHANGED
@@ -4,7 +4,6 @@ class CreateAudits < ActiveRecord::Migration
|
|
4
4
|
t.references :auditable, null: false, index: true, polymorphic: true
|
5
5
|
t.references :user, index: true
|
6
6
|
t.integer :source, null: false, default: 0
|
7
|
-
t.integer :version, null: false, default: 0
|
8
7
|
t.string :action, null: false
|
9
8
|
t.text :revisions
|
10
9
|
t.text :comment
|
@@ -16,6 +16,18 @@ class Audit < ActiveRecord::Base
|
|
16
16
|
validates :user_id, numericality: { integer: true },
|
17
17
|
allow_blank: true,
|
18
18
|
allow_nil: true
|
19
|
-
|
19
|
+
|
20
|
+
def self.record!(object, action, user: ActiveAudit.configuration.auditor, source: :app, comment: nil, remote_ip: nil, remote_uuid: nil)
|
21
|
+
create!({
|
22
|
+
auditable: object,
|
23
|
+
user: user,
|
24
|
+
source: source,
|
25
|
+
action: action,
|
26
|
+
revisions: object.changes,
|
27
|
+
comment: comment,
|
28
|
+
remote_ip: remote_ip,
|
29
|
+
remote_uuid: remote_uuid
|
30
|
+
})
|
31
|
+
end
|
20
32
|
|
21
33
|
end
|