acts_as_protocolable 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +2 -0
- data/VERSION +1 -1
- data/lib/acts_as_protocolable.rb +10 -13
- metadata +3 -3
data/README.textile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/lib/acts_as_protocolable.rb
CHANGED
@@ -2,15 +2,12 @@ module ActsAsProtocolable
|
|
2
2
|
mattr_accessor :internal_user_id
|
3
3
|
|
4
4
|
module ClassMethods
|
5
|
-
def
|
6
|
-
self.
|
5
|
+
def acts_as_protocolablable(options = {})
|
6
|
+
self.acts_as_protocolable_model(options)
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
|
11
|
-
puts options
|
12
|
-
puts "!!!!!!"
|
13
|
-
include ActsAsProtocoled::InstanceMethods
|
9
|
+
def acts_as_protocolable_model(options = {})
|
10
|
+
include ActsAsProtocolable::InstanceMethods
|
14
11
|
|
15
12
|
unless options.has_key?(:only)
|
16
13
|
after_create :protocol_on_create
|
@@ -27,29 +24,29 @@ module ActsAsProtocolable
|
|
27
24
|
module InstanceMethods
|
28
25
|
protected
|
29
26
|
def protocol_on_create
|
30
|
-
|
27
|
+
ActsAsProtocolable::Base.create(
|
31
28
|
:affected_object_type => self.class.to_s,
|
32
29
|
:affected_object_id => self.id,
|
33
30
|
:action_type => "CREATE",
|
34
|
-
:internal_user_id =>
|
31
|
+
:internal_user_id => ActsAsProtocolable.internal_user_id
|
35
32
|
)
|
36
33
|
end
|
37
34
|
|
38
35
|
def protocol_on_update
|
39
|
-
|
36
|
+
ActsAsProtocolable::Base.create(
|
40
37
|
:affected_object_type => self.class.to_s,
|
41
38
|
:affected_object_id => self.id,
|
42
39
|
:action_type => "UPDATE",
|
43
|
-
:internal_user_id =>
|
40
|
+
:internal_user_id => ActsAsProtocolable.internal_user_id
|
44
41
|
)
|
45
42
|
end
|
46
43
|
|
47
44
|
def protocol_on_destroy
|
48
|
-
|
45
|
+
ActsAsProtocolable::Base.create(
|
49
46
|
:affected_object_type => self.class.to_s,
|
50
47
|
:affected_object_id => self.id,
|
51
48
|
:action_type => "DESTROY",
|
52
|
-
:internal_user_id =>
|
49
|
+
:internal_user_id => ActsAsProtocolable.internal_user_id
|
53
50
|
)
|
54
51
|
end
|
55
52
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_protocolable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Igor Alexandrov
|