ar-audit-tracer 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +7 -5
- data/ar-audit-tracer.gemspec +1 -2
- data/lib/active_record/author_stamp.rb +2 -2
- data/lib/ar-audit-tracer/version.rb +1 -1
- metadata +5 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26c0ae9367503e4fbdf82979c8dc9e6282abc370
|
4
|
+
data.tar.gz: 746cd974116dcceec534489d53af3ecfdd656523
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cac3e876798d3d2227896d8ad0695b7df5f4efe59f850a7f3a7199bb1e166ce1fb353b80288411ee6fca056a492e65da22ea65315474b6dadc06b3b291f357e7
|
7
|
+
data.tar.gz: 6c72b621047bccdebf36a9d553ca12f8584ab7f14f7840ea25f32eab0a0b33a26b18be8945c62fe3daf2428df8c3b939bb6eba9bb1f988a76e48b11e088ec0b8
|
data/README.rdoc
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
= ar-audit-tracer
|
2
2
|
|
3
|
+
{<img src="https://badge.fury.io/rb/ar-audit-tracer.png" alt="Gem Version" />}[http://badge.fury.io/rb/ar-audit-tracer]
|
3
4
|
{<img src="https://secure.travis-ci.org/verticonaut/ar-audit-tracer.png" />}[http://travis-ci.org/verticonaut/ar-audit-tracer]
|
5
|
+
{<img src="https://codeclimate.com/github/verticonaut/ar-audit-tracer.png" />}[https://codeclimate.com/github/verticonaut/ar-audit-tracer]
|
4
6
|
|
5
7
|
== Summary
|
6
8
|
|
@@ -9,7 +11,7 @@ It works exactly like 'timestamps' (see usage below).
|
|
9
11
|
|
10
12
|
The new version 2.0.0 works now for Rails 4.0 with Ruby 1.9.3 and 2.0.0. Use the version 1.0.2 for Rails ~3.0 with Ruby 1.8.7 or higher.
|
11
13
|
|
12
|
-
|
14
|
+
=== Note
|
13
15
|
The migration helpers changed. The column statement is now named +t.authorstamps+ instead of +t.authors+.
|
14
16
|
Similar the changing a table is named +add_authorstamp+. The columns generated are still named the same - so they are calles
|
15
17
|
+created_by+ and +updated_by+.
|
@@ -45,15 +47,15 @@ or
|
|
45
47
|
|
46
48
|
==== Note
|
47
49
|
The _authorstamps_ methods are simple conveniance methods (as regular timestamp methods are). You can simply
|
48
|
-
add columns named +created_by+ and +updated_by+ using regular migration statements.<
|
49
|
-
|
50
|
+
add columns named +created_by+ and +updated_by+ using regular migration statements.<p/>
|
51
|
+
You can name the attributes +created_by_id+ and +updated_by_id+. If these columns are detected they are filled as well.
|
50
52
|
|
51
53
|
=== Configuration
|
52
54
|
|
53
55
|
All you need to do is to set the current author such as e.g:
|
54
56
|
Concern::Audit::Author.current="bad_man"
|
55
57
|
|
56
|
-
Each ActiveRecord +save+ or +update+ then will set the respetive attributes +created_by+ and +
|
58
|
+
Each ActiveRecord +save+ or +update+ then will set the respetive attributes +created_by+ and +updated_by+ automatically, whereas the modifier is set to the same value as the creator on model creation.
|
57
59
|
|
58
60
|
In a Rails Application you would set the author as described above in a +before_filter+.
|
59
61
|
<tt>Concern::Audit::Author</tt> stores the author in a Thread-Local variable.
|
@@ -69,4 +71,4 @@ In case you need associations to a respective Author Model you have to set them
|
|
69
71
|
* Works now not only for +created_by+ and +updated_by+, but as well for attributes +created_by_id+ and +updated_by_id+
|
70
72
|
|
71
73
|
=== Version 1.0.2
|
72
|
-
* Fixed migrations so option can be passed
|
74
|
+
* Fixed migrations so option can be passed
|
data/ar-audit-tracer.gemspec
CHANGED
@@ -15,8 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
|
16
16
|
s.add_dependency "activerecord", "~> 4.0"
|
17
17
|
|
18
|
-
s.add_development_dependency "
|
19
|
-
s.add_development_dependency "sqlite3"
|
18
|
+
s.add_development_dependency "sqlite3", "~> 0"
|
20
19
|
|
21
20
|
s.rdoc_options << '--charset' << 'UTF-8' << '--line-numbers'
|
22
21
|
s.files = `git ls-files`.split("\n")
|
@@ -27,7 +27,7 @@ module ActiveRecord
|
|
27
27
|
|
28
28
|
private
|
29
29
|
|
30
|
-
def
|
30
|
+
def _create_record
|
31
31
|
if self.record_authorstamps
|
32
32
|
all_authorstamp_attributes.each do |column|
|
33
33
|
if respond_to?(column) && respond_to?("#{column}=") && self.send(column).nil?
|
@@ -39,7 +39,7 @@ module ActiveRecord
|
|
39
39
|
super
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
42
|
+
def _update_record(*args)
|
43
43
|
if should_record_authorstamps?
|
44
44
|
authorstamp_attributes_for_update_in_model.each do |column|
|
45
45
|
column = column.to_s
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar-audit-tracer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Schweizer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -24,32 +24,18 @@ dependencies:
|
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: activerecord
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '4.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ~>
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '4.0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: sqlite3
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
|
-
- -
|
31
|
+
- - ~>
|
46
32
|
- !ruby/object:Gem::Version
|
47
33
|
version: '0'
|
48
34
|
type: :development
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
|
-
- -
|
38
|
+
- - ~>
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '0'
|
55
41
|
description: Handles ActiveRecord authors in the same way as timstamps.
|
@@ -104,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
90
|
version: '0'
|
105
91
|
requirements: []
|
106
92
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.
|
93
|
+
rubygems_version: 2.2.2
|
108
94
|
signing_key:
|
109
95
|
specification_version: 4
|
110
96
|
summary: Track creator/modifiers of you AR Models similar to timestamps.
|