ar-audit-tracer 1.0.2 → 2.0.0
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 +7 -0
- data/.rvmrc +1 -1
- data/.travis.yml +2 -5
- data/Gemfile.lock +28 -20
- data/README.rdoc +19 -9
- data/ar-audit-tracer.gemspec +2 -2
- data/gemfiles/rails4_0.gemfile +9 -0
- data/lib/active_record/author_stamp.rb +93 -0
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +15 -0
- data/lib/active_record/migration/command_recorder.rb +40 -0
- data/lib/ar-audit-tracer.rb +10 -97
- data/lib/ar-audit-tracer/version.rb +1 -1
- data/test/resources/migrations/add_authors.rb +2 -2
- data/test/resources/migrations/change_table_authors.rb +2 -2
- data/test/resources/schema.rb +3 -3
- data/test/test_ar-audit-tracer.rb +8 -8
- metadata +17 -24
- data/gemfiles/rails3_0.gemfile +0 -8
- data/gemfiles/rails3_1.gemfile +0 -8
- data/gemfiles/rails3_2.gemfile +0 -8
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b0cc3002d73e4ecaeae431164cbac4078b67a10f
|
4
|
+
data.tar.gz: 8bce9b4669e9d8c2cbe44ed3b54b4aff002ee924
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0419dacc98f06fb067be5d487f03540f14b2dfaf6620eb83d76a559d479064add1c8ca24d2bb46e45ec1ae33c6a8766f6acbee5c715a14ebbc3511e1487824d8
|
7
|
+
data.tar.gz: 0fb20cc963c08ed92ee12d41f24d9326bd4f6deaf3b3d855c71f6d83208264cb05901ddab6f58086c5de846aea8ac0a6ed0ea5df89bfd1339be7ef7cc250f1f2
|
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm use
|
1
|
+
rvm use 2.0.0-p247
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,36 +1,44 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ar-audit-tracer (
|
5
|
-
activerecord (~>
|
4
|
+
ar-audit-tracer (2.0.0)
|
5
|
+
activerecord (~> 4.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (
|
11
|
-
activesupport (=
|
12
|
-
builder (~> 3.
|
13
|
-
activerecord (
|
14
|
-
activemodel (=
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
10
|
+
activemodel (4.0.0)
|
11
|
+
activesupport (= 4.0.0)
|
12
|
+
builder (~> 3.1.0)
|
13
|
+
activerecord (4.0.0)
|
14
|
+
activemodel (= 4.0.0)
|
15
|
+
activerecord-deprecated_finders (~> 1.0.2)
|
16
|
+
activesupport (= 4.0.0)
|
17
|
+
arel (~> 4.0.0)
|
18
|
+
activerecord-deprecated_finders (1.0.3)
|
19
|
+
activesupport (4.0.0)
|
20
|
+
i18n (~> 0.6, >= 0.6.4)
|
21
|
+
minitest (~> 4.2)
|
22
|
+
multi_json (~> 1.3)
|
23
|
+
thread_safe (~> 0.1)
|
24
|
+
tzinfo (~> 0.3.37)
|
25
|
+
arel (4.0.0)
|
26
|
+
atomic (1.1.10)
|
27
|
+
builder (3.1.4)
|
28
|
+
i18n (0.6.4)
|
29
|
+
minitest (4.7.5)
|
30
|
+
multi_json (1.7.7)
|
25
31
|
rake (0.9.2.2)
|
26
|
-
sqlite3 (1.3.
|
27
|
-
|
32
|
+
sqlite3 (1.3.6)
|
33
|
+
thread_safe (0.1.0)
|
34
|
+
atomic
|
35
|
+
tzinfo (0.3.37)
|
28
36
|
|
29
37
|
PLATFORMS
|
30
38
|
ruby
|
31
39
|
|
32
40
|
DEPENDENCIES
|
33
|
-
activerecord (~>
|
41
|
+
activerecord (~> 4.0)
|
34
42
|
ar-audit-tracer!
|
35
43
|
rake
|
36
44
|
sqlite3
|
data/README.rdoc
CHANGED
@@ -7,7 +7,12 @@
|
|
7
7
|
<i>ar-audit-tracer</i> patches ActiveRecord so modifiers of a record can be traked on saving (insert/update).
|
8
8
|
It works exactly like 'timestamps' (see usage below).
|
9
9
|
|
10
|
-
The new version
|
10
|
+
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
|
+
|
12
|
+
**Note**<br/>
|
13
|
+
The migration helpers changed. The column statement is now named +t.authorstamps+ instead of +t.authors+.
|
14
|
+
Similar the changing a table is named +add_authorstamp+. The columns generated are still named the same - so they are calles
|
15
|
+
+created_by+ and +updated_by+.
|
11
16
|
|
12
17
|
|
13
18
|
== Installation
|
@@ -21,26 +26,27 @@ Add below to your Gemfile and run the +bundle+ command
|
|
21
26
|
=== Migration
|
22
27
|
|
23
28
|
In a models migration add:
|
24
|
-
t.
|
29
|
+
t.authorstamps
|
25
30
|
|
26
31
|
This will add columns +created_by+ and +updated_by+ of type +:string+ to your model.
|
27
32
|
|
28
33
|
In case you want to use another type, simply pass the type as argument, e.g.
|
29
|
-
t.
|
34
|
+
t.authorstamps(:integer)
|
30
35
|
|
31
|
-
By default the columns are mandatory (
|
36
|
+
By default the columns are mandatory (<tt>:null => false</tt>). If you have existing models you want to change
|
32
37
|
you have to pass the option <tt>:null => true</tt>, update the values in the new attributes columns and add another
|
33
38
|
migration to change the column to <tt>:null => false</tt> if required.
|
34
|
-
Note
|
35
|
-
|
39
|
+
*Note:* If you pass options you have to pass the type as well - sample migration statments:
|
40
|
+
add_authorstamps(:your_table_name, :string, :null => true)
|
36
41
|
or
|
37
42
|
change_table :your_table_name do |t|
|
38
|
-
t.
|
43
|
+
t.authorstamps(:integer, :null => true)
|
39
44
|
end
|
40
45
|
|
41
46
|
==== Note
|
42
|
-
The
|
43
|
-
add columns named +created_by+ and +updated_by+ using regular migration statements
|
47
|
+
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.<br/>
|
49
|
+
**Note** You can name the attributes +created_by_id+ and +updated_by_id+. If these columns are detected they are filled as well.
|
44
50
|
|
45
51
|
=== Configuration
|
46
52
|
|
@@ -58,5 +64,9 @@ In case you need associations to a respective Author Model you have to set them
|
|
58
64
|
|
59
65
|
== Changelog
|
60
66
|
|
67
|
+
=== Version 2.0.0
|
68
|
+
* Works for Rails4 with Ruby1.9.3 and Ruby 2.0.0
|
69
|
+
* Works now not only for +created_by+ and +updated_by+, but as well for attributes +created_by_id+ and +updated_by_id+
|
70
|
+
|
61
71
|
=== Version 1.0.2
|
62
72
|
* Fixed migrations so option can be passed
|
data/ar-audit-tracer.gemspec
CHANGED
@@ -13,9 +13,9 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.summary = %q{Track creator/modifiers of you AR Models similar to timestamps.}
|
14
14
|
s.description = %q{Handles ActiveRecord authors in the same way as timstamps.}
|
15
15
|
|
16
|
-
s.add_dependency "activerecord", "~>
|
16
|
+
s.add_dependency "activerecord", "~> 4.0"
|
17
17
|
|
18
|
-
s.add_development_dependency "activerecord", "~>
|
18
|
+
s.add_development_dependency "activerecord", "~> 4.0"
|
19
19
|
s.add_development_dependency "sqlite3"
|
20
20
|
|
21
21
|
s.rdoc_options << '--charset' << 'UTF-8' << '--line-numbers'
|
@@ -0,0 +1,93 @@
|
|
1
|
+
|
2
|
+
module ActiveRecord
|
3
|
+
# = Active Record Authorstamp
|
4
|
+
#
|
5
|
+
# Active Record automatically stamps the user that performns create and update operations if the
|
6
|
+
# table has fields named <tt>created_by/created_by_id</tt> or
|
7
|
+
# <tt>updated_by/updated_by</tt>.
|
8
|
+
# The user identifier is taken from ActiveRecord::Audit::Author.current. The respective value must be set
|
9
|
+
# by the user of this feater by calling ActiveRecord::Audit::Author.current = 'some_value'
|
10
|
+
#
|
11
|
+
# Userstamping can be turned off by setting:
|
12
|
+
#
|
13
|
+
# config.active_record.record_userstamps = false
|
14
|
+
#
|
15
|
+
module AuthorStamp
|
16
|
+
extend ActiveSupport::Concern
|
17
|
+
|
18
|
+
included do
|
19
|
+
class_attribute :record_authorstamps
|
20
|
+
self.record_authorstamps = true
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize_dup(other) # :nodoc:
|
24
|
+
clear_authorstamp_attributes
|
25
|
+
super
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def create_record
|
31
|
+
if self.record_authorstamps
|
32
|
+
all_authorstamp_attributes.each do |column|
|
33
|
+
if respond_to?(column) && respond_to?("#{column}=") && self.send(column).nil?
|
34
|
+
write_attribute(column.to_s, current_author)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
super
|
40
|
+
end
|
41
|
+
|
42
|
+
def update_record(*args)
|
43
|
+
if should_record_authorstamps?
|
44
|
+
authorstamp_attributes_for_update_in_model.each do |column|
|
45
|
+
column = column.to_s
|
46
|
+
next if attribute_changed?(column)
|
47
|
+
write_attribute(column, current_author)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
super
|
51
|
+
end
|
52
|
+
|
53
|
+
def should_record_authorstamps?
|
54
|
+
self.record_authorstamps && (!partial_writes? || changed? || (attributes.keys & self.class.serialized_attributes.keys).present?)
|
55
|
+
end
|
56
|
+
|
57
|
+
def authorstamp_attributes_for_create_in_model
|
58
|
+
authorstamp_attributes_for_create.select { |c| self.class.column_names.include?(c.to_s) }
|
59
|
+
end
|
60
|
+
|
61
|
+
def authorstamp_attributes_for_update_in_model
|
62
|
+
authorstamp_attributes_for_update.select { |c| self.class.column_names.include?(c.to_s) }
|
63
|
+
end
|
64
|
+
|
65
|
+
def all_authorstamp_attributes_in_model
|
66
|
+
authorstamp_attributes_for_create_in_model + authorstamp_attributes_for_update_in_model
|
67
|
+
end
|
68
|
+
|
69
|
+
def authorstamp_attributes_for_update
|
70
|
+
[:updated_by, :updated_by_id]
|
71
|
+
end
|
72
|
+
|
73
|
+
def authorstamp_attributes_for_create
|
74
|
+
[:created_by, :created_by_id]
|
75
|
+
end
|
76
|
+
|
77
|
+
def all_authorstamp_attributes
|
78
|
+
authorstamp_attributes_for_create + authorstamp_attributes_for_update
|
79
|
+
end
|
80
|
+
|
81
|
+
def current_author
|
82
|
+
Concern::Audit::Author.current
|
83
|
+
end
|
84
|
+
|
85
|
+
# Clear attributes and changed_attributes
|
86
|
+
def clear_authorstamp_attributes
|
87
|
+
all_authorstamp_attributes_in_model.each do |attribute_name|
|
88
|
+
self[attribute_name] = nil
|
89
|
+
changed_attributes.delete(attribute_name)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module ConnectionAdapters
|
3
|
+
class AbstractMysqlAdapter < AbstractAdapter
|
4
|
+
|
5
|
+
def add_authorstamps_sql(table_name)
|
6
|
+
[add_column_sql(table_name, :created_by, :string), add_column_sql(table_name, :updated_by, :string)]
|
7
|
+
end
|
8
|
+
|
9
|
+
def remove_authorstamps_sql(table_name)
|
10
|
+
[remove_column_sql(table_name, :updated_by), remove_column_sql(table_name, :created_by)]
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
class Migration
|
3
|
+
# <tt>ActiveRecord::Migration::CommandRecorder</tt> records commands done during
|
4
|
+
# a migration and knows how to reverse those commands. The CommandRecorder
|
5
|
+
# knows how to invert the following commands:
|
6
|
+
#
|
7
|
+
# Adds...
|
8
|
+
# * add_authorstamps
|
9
|
+
# * remove_authorstamps
|
10
|
+
class CommandRecorder
|
11
|
+
|
12
|
+
[ # irreversible methods need to be here too
|
13
|
+
:add_authorstamps,
|
14
|
+
:remove_authorstamps,
|
15
|
+
].each do |method|
|
16
|
+
class_eval <<-EOV, __FILE__, __LINE__ + 1
|
17
|
+
def #{method}(*args, &block) # def create_table(*args, &block)
|
18
|
+
record(:"#{method}", args, &block) # record(:create_table, args, &block)
|
19
|
+
end # end
|
20
|
+
EOV
|
21
|
+
end
|
22
|
+
|
23
|
+
module StraightReversions
|
24
|
+
private
|
25
|
+
{ add_authorstamps: :remove_authorstamps }.each do |cmd, inv|
|
26
|
+
[[inv, cmd], [cmd, inv]].uniq.each do |method, inverse|
|
27
|
+
class_eval <<-EOV, __FILE__, __LINE__ + 1
|
28
|
+
def invert_#{method}(args, &block) # def invert_create_table(args, &block)
|
29
|
+
[:#{inverse}, args, block] # [:drop_table, args, block]
|
30
|
+
end # end
|
31
|
+
EOV
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
include StraightReversions
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/ar-audit-tracer.rb
CHANGED
@@ -1,104 +1,17 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
+
require 'active_record/migration/command_recorder'
|
3
|
+
require 'active_record/author_stamp'
|
2
4
|
require 'concern/audit/author'
|
3
5
|
|
4
6
|
module ActiveRecord
|
5
7
|
|
6
|
-
# = Active Record Author
|
7
|
-
#
|
8
|
-
# Active Record automatically authors create and update operations if the
|
9
|
-
# table has fields named <tt>created_by</tt> or
|
10
|
-
# <tt>updated_by</tt>.
|
11
|
-
#
|
12
|
-
# Authoring can be turned off by setting:
|
13
|
-
#
|
14
|
-
# <tt>ActiveRecord::Base.record_authors = false</tt>
|
15
|
-
module Author
|
16
|
-
extend ActiveSupport::Concern
|
17
|
-
|
18
|
-
included do
|
19
|
-
class_attribute :record_authors
|
20
|
-
self.record_authors = true
|
21
|
-
end
|
22
|
-
|
23
|
-
def initialize_dup(other)
|
24
|
-
clear_author_attributes
|
25
|
-
end
|
26
|
-
|
27
|
-
private
|
28
|
-
|
29
|
-
def create #:nodoc:
|
30
|
-
if self.record_authors
|
31
|
-
current_author = Concern::Audit::Author.current
|
32
|
-
|
33
|
-
all_author_attributes.each do |column|
|
34
|
-
if respond_to?(column) && self.send(column).nil?
|
35
|
-
write_attribute(column.to_s, current_author)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
super
|
41
|
-
end
|
42
|
-
|
43
|
-
def update(*args) #:nodoc:
|
44
|
-
if should_record_authors?
|
45
|
-
current_author = Concern::Audit::Author.current
|
46
|
-
|
47
|
-
author_attributes_for_update_in_model.each do |column|
|
48
|
-
column = column.to_s
|
49
|
-
next if attribute_changed?(column)
|
50
|
-
write_attribute(column, current_author)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
super
|
54
|
-
end
|
55
|
-
|
56
|
-
def should_record_authors?
|
57
|
-
self.record_authors && (!partial_updates? || changed? || (attributes.keys & self.class.serialized_attributes.keys).present?)
|
58
|
-
end
|
59
|
-
|
60
|
-
def author_attributes_for_update_in_model
|
61
|
-
author_attributes_for_update.select { |c| respond_to?(c) }
|
62
|
-
end
|
63
|
-
|
64
|
-
def author_attributes_for_create_in_model
|
65
|
-
author_attributes_for_create.select { |c| respond_to?(c) }
|
66
|
-
end
|
67
|
-
|
68
|
-
def all_author_attributes
|
69
|
-
author_attributes_for_create + author_attributes_for_update
|
70
|
-
end
|
71
|
-
|
72
|
-
def author_attributes_for_update #:nodoc:
|
73
|
-
[:updated_by]
|
74
|
-
end
|
75
|
-
|
76
|
-
def author_attributes_for_create #:nodoc:
|
77
|
-
[:created_by]
|
78
|
-
end
|
79
|
-
|
80
|
-
def all_author_attributes_in_model
|
81
|
-
author_attributes_for_create_in_model + author_attributes_for_update_in_model
|
82
|
-
end
|
83
|
-
|
84
|
-
# Clear attributes and changed_attributes
|
85
|
-
def clear_author_attributes
|
86
|
-
all_author_attributes_in_model.each do |attribute_name|
|
87
|
-
self[attribute_name] = nil
|
88
|
-
changed_attributes.delete(attribute_name)
|
89
|
-
end
|
90
|
-
end
|
91
|
-
|
92
|
-
end
|
93
|
-
|
94
|
-
|
95
8
|
|
96
9
|
module ConnectionAdapters
|
97
10
|
module SchemaStatements
|
98
11
|
# Adds author columns (created_by and updated_by) to the named table.
|
99
12
|
# ===== Examples
|
100
13
|
# add_authors(:suppliers)
|
101
|
-
def
|
14
|
+
def add_authorstamps(table_name, type=:string, *args)
|
102
15
|
options = {:null => false}.merge(args.extract_options!)
|
103
16
|
add_column table_name, :created_by, type, options
|
104
17
|
add_column table_name, :updated_by, type, options
|
@@ -107,7 +20,7 @@ module ActiveRecord
|
|
107
20
|
# Removes the author columns (created_by and updated_by) from the table definition.
|
108
21
|
# ===== Examples
|
109
22
|
# remove_authors(:suppliers)
|
110
|
-
def
|
23
|
+
def remove_authorstamps(table_name)
|
111
24
|
remove_column table_name, :updated_by
|
112
25
|
remove_column table_name, :created_by
|
113
26
|
end
|
@@ -120,7 +33,7 @@ module ActiveRecord
|
|
120
33
|
#
|
121
34
|
# @param Symbol type The desired type for the columns, defaults to :string
|
122
35
|
# @param Hash *args Column options from rails
|
123
|
-
def
|
36
|
+
def authorstamps(type=:string, *args)
|
124
37
|
options = args.extract_options!
|
125
38
|
column(:created_by, type, options)
|
126
39
|
column(:updated_by, type, options)
|
@@ -135,16 +48,16 @@ module ActiveRecord
|
|
135
48
|
#
|
136
49
|
# @param Symbol type The desired type for the columns, defaults to :string
|
137
50
|
# @see SchemaStatements#add_authors
|
138
|
-
def
|
51
|
+
def authorstamps(type=:string, *args)
|
139
52
|
options = {:null => false}.merge(args.extract_options!)
|
140
|
-
@base.
|
53
|
+
@base.add_authorstamps(@table_name, type, options)
|
141
54
|
end
|
142
55
|
|
143
56
|
# Removes the author columns (created_by and updated_by) from the table.
|
144
57
|
# ===== Example
|
145
58
|
# t.remove_authors
|
146
|
-
def
|
147
|
-
@base.
|
59
|
+
def remove_authorstamps
|
60
|
+
@base.remove_authorstamps(@table_name)
|
148
61
|
end
|
149
62
|
|
150
63
|
end
|
@@ -153,7 +66,7 @@ module ActiveRecord
|
|
153
66
|
|
154
67
|
|
155
68
|
Base.class_eval do
|
156
|
-
include
|
69
|
+
include ActiveRecord::AuthorStamp
|
157
70
|
end
|
158
71
|
|
159
72
|
end
|
data/test/resources/schema.rb
CHANGED
@@ -5,14 +5,14 @@ ActiveRecord::Schema.define(:version => 0) do
|
|
5
5
|
|
6
6
|
create_table :with_string_authors, :force => true do |t|
|
7
7
|
t.string :name
|
8
|
-
t.
|
8
|
+
t.authorstamps
|
9
9
|
end
|
10
10
|
|
11
11
|
create_table :with_integer_authors, :force => true do |t|
|
12
12
|
t.string :name
|
13
|
-
t.
|
13
|
+
t.authorstamps(:integer)
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
create_table :blank_ones, :force => true do |t|
|
17
17
|
t.string :name
|
18
18
|
end
|
@@ -6,7 +6,7 @@ require 'resources/migrations/change_table_authors'
|
|
6
6
|
class TestArAuditTracer < Test::Unit::TestCase
|
7
7
|
|
8
8
|
def setup
|
9
|
-
Concern::Audit::Author.current=nil
|
9
|
+
Concern::Audit::Author.current=nil
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_author_attributes_available
|
@@ -33,7 +33,7 @@ class TestArAuditTracer < Test::Unit::TestCase
|
|
33
33
|
# test :string coded authors
|
34
34
|
Concern::Audit::Author.current="creator"
|
35
35
|
audited_record = WithStringAuthor.create!
|
36
|
-
|
36
|
+
|
37
37
|
assert_equal audited_record.created_by, "creator"
|
38
38
|
assert_equal audited_record.updated_by, "creator"
|
39
39
|
|
@@ -94,10 +94,10 @@ class TestArAuditTracer < Test::Unit::TestCase
|
|
94
94
|
end
|
95
95
|
|
96
96
|
def test_migration_add_authors
|
97
|
-
assert !BlankTwo.attribute_names.include?(:created_by)
|
98
|
-
assert !BlankTwo.attribute_names.include?(:updated_by)
|
97
|
+
assert !BlankTwo.new().attribute_names.include?(:created_by)
|
98
|
+
assert !BlankTwo.new().attribute_names.include?(:updated_by)
|
99
99
|
|
100
|
-
AddAuthors.
|
100
|
+
AddAuthors.up
|
101
101
|
BlankTwo.reset_column_information
|
102
102
|
|
103
103
|
assert_equal :string, BlankTwo.columns_hash['created_by'].type
|
@@ -105,10 +105,10 @@ class TestArAuditTracer < Test::Unit::TestCase
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def test_migration_change_table_authors
|
108
|
-
assert !BlankOne.attribute_names.include?(:created_by)
|
109
|
-
assert !BlankOne.attribute_names.include?(:updated_by)
|
108
|
+
assert !BlankOne.new().attribute_names.include?(:created_by)
|
109
|
+
assert !BlankOne.new().attribute_names.include?(:updated_by)
|
110
110
|
|
111
|
-
ChangeTableAuthors.
|
111
|
+
ChangeTableAuthors.up
|
112
112
|
BlankOne.reset_column_information
|
113
113
|
|
114
114
|
assert_equal :integer, BlankOne.columns_hash['created_by'].type
|
metadata
CHANGED
@@ -1,62 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar-audit-tracer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Martin Schweizer
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-07-24 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activerecord
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
19
|
+
version: '4.0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
26
|
+
version: '4.0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: activerecord
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version: '
|
33
|
+
version: '4.0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version: '
|
40
|
+
version: '4.0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: sqlite3
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
description: Handles ActiveRecord authors in the same way as timstamps.
|
@@ -75,9 +68,10 @@ files:
|
|
75
68
|
- README.rdoc
|
76
69
|
- Rakefile
|
77
70
|
- ar-audit-tracer.gemspec
|
78
|
-
- gemfiles/
|
79
|
-
-
|
80
|
-
-
|
71
|
+
- gemfiles/rails4_0.gemfile
|
72
|
+
- lib/active_record/author_stamp.rb
|
73
|
+
- lib/active_record/connection_adapters/abstract_mysql_adapter.rb
|
74
|
+
- lib/active_record/migration/command_recorder.rb
|
81
75
|
- lib/ar-audit-tracer.rb
|
82
76
|
- lib/ar-audit-tracer/version.rb
|
83
77
|
- lib/concern/audit/author.rb
|
@@ -90,6 +84,7 @@ files:
|
|
90
84
|
- test/test_ar-audit-tracer.rb
|
91
85
|
homepage: http://github.com/verticonaut/ar-audit-tracer
|
92
86
|
licenses: []
|
87
|
+
metadata: {}
|
93
88
|
post_install_message:
|
94
89
|
rdoc_options:
|
95
90
|
- --charset
|
@@ -98,22 +93,20 @@ rdoc_options:
|
|
98
93
|
require_paths:
|
99
94
|
- lib
|
100
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
-
none: false
|
102
96
|
requirements:
|
103
|
-
- -
|
97
|
+
- - '>='
|
104
98
|
- !ruby/object:Gem::Version
|
105
99
|
version: '0'
|
106
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
101
|
requirements:
|
109
|
-
- -
|
102
|
+
- - '>='
|
110
103
|
- !ruby/object:Gem::Version
|
111
104
|
version: '0'
|
112
105
|
requirements: []
|
113
106
|
rubyforge_project:
|
114
|
-
rubygems_version:
|
107
|
+
rubygems_version: 2.0.5
|
115
108
|
signing_key:
|
116
|
-
specification_version:
|
109
|
+
specification_version: 4
|
117
110
|
summary: Track creator/modifiers of you AR Models similar to timestamps.
|
118
111
|
test_files:
|
119
112
|
- test/concern/audit/author_test.rb
|
data/gemfiles/rails3_0.gemfile
DELETED
data/gemfiles/rails3_1.gemfile
DELETED