after_commit 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
@@ -4,8 +4,9 @@ module AfterCommit
|
|
4
4
|
base.class_eval do
|
5
5
|
class << self
|
6
6
|
def establish_connection_with_after_commit(spec = nil)
|
7
|
-
establish_connection_without_after_commit spec
|
7
|
+
result = establish_connection_without_after_commit spec
|
8
8
|
include_after_commit_extensions
|
9
|
+
result
|
9
10
|
end
|
10
11
|
alias_method_chain :establish_connection, :after_commit
|
11
12
|
|
@@ -10,21 +10,23 @@ module AfterCommit
|
|
10
10
|
def commit_db_transaction_with_callback
|
11
11
|
increment_transaction_pointer
|
12
12
|
committed = false
|
13
|
+
result = nil
|
13
14
|
begin
|
14
15
|
trigger_before_commit_callbacks
|
15
16
|
trigger_before_commit_on_create_callbacks
|
16
17
|
trigger_before_commit_on_update_callbacks
|
17
18
|
trigger_before_commit_on_destroy_callbacks
|
18
19
|
|
19
|
-
commit_db_transaction_without_callback
|
20
|
+
result = commit_db_transaction_without_callback
|
20
21
|
committed = true
|
21
22
|
|
22
23
|
trigger_after_commit_callbacks
|
23
24
|
trigger_after_commit_on_create_callbacks
|
24
25
|
trigger_after_commit_on_update_callbacks
|
25
26
|
trigger_after_commit_on_destroy_callbacks
|
27
|
+
result
|
26
28
|
rescue
|
27
|
-
|
29
|
+
committed ? result : rollback_db_transaction
|
28
30
|
ensure
|
29
31
|
AfterCommit.cleanup(self)
|
30
32
|
decrement_transaction_pointer
|
@@ -37,9 +39,11 @@ module AfterCommit
|
|
37
39
|
# callback for each record that failed to be committed.
|
38
40
|
def rollback_db_transaction_with_callback
|
39
41
|
begin
|
42
|
+
result = nil
|
40
43
|
trigger_before_rollback_callbacks
|
41
|
-
rollback_db_transaction_without_callback
|
44
|
+
result = rollback_db_transaction_without_callback
|
42
45
|
trigger_after_rollback_callbacks
|
46
|
+
result
|
43
47
|
ensure
|
44
48
|
AfterCommit.cleanup(self)
|
45
49
|
end
|
data/test/after_commit_test.rb
CHANGED
data/test/observer_test.rb
CHANGED
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: after_commit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Muerdter
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date:
|
14
|
+
date: 2010-02-16 00:00:00 +11:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|