active-audit 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7bd6bdab2bd594da4c3c2d0cdecda2eb89c7cc24
4
- data.tar.gz: e7d7a9adbfac2de99cbe33cdb2cf6cf4c7540342
3
+ metadata.gz: 260709ac6610447a1136f991de13c1f7346489fe
4
+ data.tar.gz: f4afc320cd3e63594516287417e40c4d5b6c5100
5
5
  SHA512:
6
- metadata.gz: cbebce4e9ecdb25440b5e95dd2a2db6ac0a1949c9fef980b004d0b8142046f84c0cc5b023e45fbc3f1bb2735d2df6a6f77e46977f8ce5a5082311fe7a4a5426e
7
- data.tar.gz: 7df98155dd7a2b2e6bf9da9102601f9b4a2bbacee58ab76ec758bb8b46152be8b2a65e0f6314996eb0585e2896160d342859eb30241fff02b80c4cf1647f7cf0
6
+ metadata.gz: b2c85b681188d5cc6bbf9ad65a90a5db0e688ed3e65297189f1b7479347b1eed1d5ee016bac78cee78ceb57ef4d52a910ead66dd099424c630b3830725c99cd4
7
+ data.tar.gz: 1996b6c669c9626f7010b8c0f9dff07e3c92b56ba1de68f9665e8af514ef51f6b3460b014adbad33cba003d66242d6762e3ce483effe5bd394fbf58c5ed7d87c
@@ -15,13 +15,13 @@ module ActiveAudit
15
15
  attribute :event, String
16
16
  attribute :type, String
17
17
  attribute :changes, Hash
18
- attribute :user, Hash, default: lambda {|o,a| ActiveAudit.default_user }
18
+ attribute :attributed_to, Hash, default: lambda {|o,a| ActiveAudit.default_user }
19
19
  attribute :comment, String
20
20
  attribute :recorded_at, Time, default: lambda { |o,a| Time.now.utc }
21
21
 
22
22
  before_save do
23
23
  self.recorded_at = Time.at(self.recorded_at) if self.recorded_at.is_a? Integer
24
- self.user = ActiveAudit.extract_user_profile.call(self.user) unless self.user.nil? || self.user.is_a?(Hash)
24
+ self.attributed_to = ActiveAudit.extract_user_profile.call(self.attributed_to) unless self.attributed_to.nil? || self.attributed_to.is_a?(Hash)
25
25
  end
26
26
 
27
27
  def initialize *args
@@ -12,13 +12,13 @@ module ActiveAudit
12
12
  end
13
13
 
14
14
  def save audit
15
- @connection.exec_query('INSERT INTO audits("item_id", "event", "type", "changes", "user_id", "user", "comment", "recorded_at") VALUES ($1,$2,$3,$4,$5,$6,$7,$8);', nil, [
15
+ @connection.exec_query('INSERT INTO audits("item_id", "event", "type", "changes", "user_id", "attributed_to", "comment", "recorded_at") VALUES ($1,$2,$3,$4,$5,$6,$7,$8);', nil, [
16
16
  [nil, audit.item_id],
17
17
  [nil, audit.event],
18
18
  [nil, audit.type],
19
19
  [nil, audit.changes.to_json],
20
- [nil, audit.user[:id]],
21
- [nil, audit.user.to_json],
20
+ [nil, audit.attributed_to[:id]],
21
+ [nil, audit.attributed_to.to_json],
22
22
  [nil, audit.comment],
23
23
  [nil, audit.recorded_at]
24
24
  ])
@@ -27,7 +27,7 @@ module ActiveAudit
27
27
  indexes :item_id, type: "long"
28
28
  indexes :event, type: "string", index: "not_analyzed"
29
29
  indexes :changes, type: "object", dynamic: true
30
- indexes :user, type: "object", properties: {
30
+ indexes :attributed_to, type: "object", properties: {
31
31
  id: { type: "long" },
32
32
  name: {type: "string", index: "not_analyzed"}
33
33
  }
@@ -17,7 +17,7 @@ module ActiveAudit
17
17
  end
18
18
 
19
19
  def before_create audit
20
- audit.user = self.user if self.user
20
+ audit.attributed_to = self.user if self.user
21
21
  audit.comment = controller.params[:comment] if controller.respond_to?(:params, true)
22
22
  audit.comment ||= ActiveAudit.session[:comment]
23
23
  end
@@ -6,7 +6,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration
6
6
  t.column :event, :string
7
7
  t.column :changes, :json
8
8
  t.column :user_id, :integer
9
- t.column :user, :json
9
+ t.column :attributed_to, :json
10
10
  t.column :comment, :string
11
11
  t.column :recorded_at, :datetime
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active-audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tariq Abughofa