cia 0.4.0 → 0.4.1
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.
- data/Gemfile.lock +1 -1
- data/Readme.md +6 -1
- data/gemfiles/rails2.gemfile.lock +1 -1
- data/gemfiles/rails3.gemfile.lock +1 -1
- data/lib/cia/auditable.rb +3 -3
- data/lib/cia/version.rb +1 -1
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/Readme.md
CHANGED
@@ -63,12 +63,17 @@ end
|
|
63
63
|
CIA.current_actor = @user
|
64
64
|
|
65
65
|
# custom changes
|
66
|
-
|
67
66
|
class User < ActiveRecord::Base
|
68
67
|
def cia_changes
|
69
68
|
changes.merge("this" => ["always", "changes"])
|
70
69
|
end
|
71
70
|
end
|
71
|
+
|
72
|
+
# using after_commit, useful if the CIA::Event is stored in a different database then the audited class
|
73
|
+
class User < ActiveRecord::Base
|
74
|
+
include CIA::Auditable
|
75
|
+
audited_attributes :email, :crypted_password, :callback => :after_commit
|
76
|
+
end
|
72
77
|
```
|
73
78
|
|
74
79
|
|
data/lib/cia/auditable.rb
CHANGED
@@ -28,11 +28,11 @@ module CIA
|
|
28
28
|
self.audited_attributes_callbacks_added = true
|
29
29
|
|
30
30
|
[:create, :update, :destroy].each do |callback|
|
31
|
-
method, args = if options[:callback]
|
32
|
-
if ActiveRecord::VERSION::MAJOR == 2
|
31
|
+
method, args = if options[:callback]
|
32
|
+
if ActiveRecord::VERSION::MAJOR == 2 && options[:callback] == :after_commit
|
33
33
|
["after_commit_on_#{callback}"]
|
34
34
|
else # rails 3+
|
35
|
-
[:
|
35
|
+
[options[:callback], [{:on => callback}]]
|
36
36
|
end
|
37
37
|
else
|
38
38
|
["after_#{callback}", []]
|
data/lib/cia/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -53,7 +53,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
53
53
|
version: '0'
|
54
54
|
segments:
|
55
55
|
- 0
|
56
|
-
hash:
|
56
|
+
hash: -1481728625417047629
|
57
57
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
58
|
none: false
|
59
59
|
requirements:
|
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
version: '0'
|
63
63
|
segments:
|
64
64
|
- 0
|
65
|
-
hash:
|
65
|
+
hash: -1481728625417047629
|
66
66
|
requirements: []
|
67
67
|
rubyforge_project:
|
68
68
|
rubygems_version: 1.8.24
|