notifiably_audited 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/audited-activerecord.gemspec +1 -1
- data/audited.gemspec +1 -1
- data/lib/notifiably_audited/auditor.rb +15 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZWJjYTgyYzAzZmNhNzAyMmEyNTYxN2U3YWM2MWUxMDcwMmNjNGFkYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWM4YzA2OWE2OTlmMDE4ZTI3NTQ2YWYwNTAxNmZkNDA1YTc0ODM3OQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTIzOGMxNzBkNWQyOTYyODQxYzk1YTlhMzg2ZDZkNGU0MzlmZDFjYTk1YTdh
|
10
|
+
ZmNjMjhiZDAxMTZhZTQwOGIzY2M4ZjY5MjUwYjA0NDIyOGY1MDZhNGY3NTI2
|
11
|
+
ZjRlN2FhNDU5N2E2MmYwMGU5MzVkMDIzMzMwNzU0MGM1Y2RhN2E=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjhiNTU4ZjhlNjk1MjdlNTYzNDc5MjVkOGMyNjMyM2E4ZGE3ZjhiM2JjNjFi
|
14
|
+
MWJmOTBiZGE0ODFmMWJkODc4YzcyZTBhMGM0MjM4ODMzMGE1MmVjMGVmNmY1
|
15
|
+
YTYwOGUwMmRiNzY3ZTg1MTc0YWQzNzQzNzQ1NDE2NDY5YTE4ZGI=
|
data/audited.gemspec
CHANGED
@@ -377,8 +377,10 @@ module NotifiablyAudited
|
|
377
377
|
@audit_values[:title] = opts[1]
|
378
378
|
@audit_values[:comment] = opts[2]
|
379
379
|
# if 3rd argument is present in the opts, then overriding title
|
380
|
+
# this is a little bit of a complicated option. If you mean that the specified column in [0], has to be only one column, contains an id of an object referenced by the [:model,:field_name] in [3], then go ahead and append it in the title.
|
381
|
+
# If the [3] is not an array but a single symbol, then fetch its value from the current object and append
|
380
382
|
if opts[3].present?
|
381
|
-
|
383
|
+
to_append = decide_append(opts[0][0],opts[3])
|
382
384
|
@audit_values[:title] = @audit_values[:title] + "[#{append}]"
|
383
385
|
end
|
384
386
|
# actual recording of audit
|
@@ -387,6 +389,18 @@ module NotifiablyAudited
|
|
387
389
|
@non_monitor = 0
|
388
390
|
end
|
389
391
|
end
|
392
|
+
|
393
|
+
def decide_append(zero,three)
|
394
|
+
if three.kind_of?(Array)
|
395
|
+
append = three[0].to_s.camelize.constantize.find(self.send(zero)).send(three[1])
|
396
|
+
elsif three.kind_of?(Symbol)
|
397
|
+
append = self.send(three)
|
398
|
+
else
|
399
|
+
errors.add(:audit_comment, "The 3rd argument for a specific alert_for item should either be an array of [:model,:field_name] or a symbol of current object's :field_name ")
|
400
|
+
return false
|
401
|
+
end
|
402
|
+
append
|
403
|
+
end
|
390
404
|
#========================================
|
391
405
|
|
392
406
|
def write_audit(attrs)
|