after_transaction_commit 1.0.0 → 1.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.md +13 -0
- data/Rakefile +1 -0
- data/after_transaction_commit.gemspec +3 -2
- data/lib/after_transaction_commit/rails4.rb +2 -0
- data/lib/after_transaction_commit/version.rb +1 -1
- metadata +18 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ed45a41c55308e3c2d73c305c8b06137a340f4d
|
4
|
+
data.tar.gz: 611cfbf86c075c63f0464ac4e3af27c18ba8c7eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8e86cc726df3be223ab37b131f2f033fedf685927cf90a3c29f722c167422b6fd96d71d3bc977747f1068b22af80e24fe0f4bab0bf0d87b3e6422fd122d32b4
|
7
|
+
data.tar.gz: b9fdffde526a87be30fe4e04ff6e73c1e03096ffea306ca62512b1cbf545755992258bc61dff4ce89f708d42ff996fb75b106c590304185e34ad3604c4ee7d2d
|
data/README.md
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
ActiveRecord::Base.connection.after_transaction_commit { ... }
|
5
5
|
```
|
6
6
|
|
7
|
+
[![Build Status](https://travis-ci.org/instructure/after_transaction_commit.svg?branch=master)](https://travis-ci.org/instructure/after_transaction_commit)
|
8
|
+
|
7
9
|
An ActiveRecord extension that allows writing callbacks to run after the
|
8
10
|
current transaction commits. This is similar to the built-in
|
9
11
|
ActiveRecord::Base#after_commit functionality, but more flexible, and
|
@@ -37,8 +39,19 @@ ActiveRecord::Base.transaction do
|
|
37
39
|
# run_some_background_job has not run yet
|
38
40
|
end
|
39
41
|
# now, it has run
|
42
|
+
|
43
|
+
# this one runs immediately, since we are outside a transaction
|
44
|
+
ActiveRecord::Base.after_transaction_commit { some_other_task }
|
40
45
|
```
|
41
46
|
|
47
|
+
### Usage in Tests
|
48
|
+
|
49
|
+
If you want to write tests that interact with `after_transaction_commit`
|
50
|
+
callbacks, pull in the
|
51
|
+
[test_after_commit](https://github.com/grosser/test_after_commit) gem in
|
52
|
+
your test environment, and things will work as expected. See that gem's
|
53
|
+
README for installation instructions.
|
54
|
+
|
42
55
|
## Contributing
|
43
56
|
|
44
57
|
1. Fork it ( https://github.com/instructure/after_transaction_commit/fork )
|
data/Rakefile
CHANGED
@@ -19,9 +19,10 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.add_dependency "activerecord", ">= 3.2"
|
21
21
|
|
22
|
-
spec.add_development_dependency "
|
22
|
+
spec.add_development_dependency "bump"
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.6"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
-
spec.add_development_dependency "sqlite3"
|
26
25
|
spec.add_development_dependency "rspec"
|
26
|
+
spec.add_development_dependency "sqlite3"
|
27
|
+
spec.add_development_dependency "wwtd"
|
27
28
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
_ = ActiveRecord::ConnectionAdapters::RealTransaction # force autoloading if necessary
|
2
|
+
|
1
3
|
klass = defined?(ActiveRecord::ConnectionAdapters::OpenTransaction) ?
|
2
4
|
ActiveRecord::ConnectionAdapters::OpenTransaction : # rails < 4.2
|
3
5
|
ActiveRecord::ConnectionAdapters::Transaction # rails >= 4.2
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: after_transaction_commit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Palmer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bump
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: sqlite3
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,7 +95,7 @@ dependencies:
|
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: wwtd
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - ">="
|
@@ -162,4 +176,3 @@ test_files:
|
|
162
176
|
- spec/gemfiles/42.gemfile
|
163
177
|
- spec/gemfiles/42.gemfile.lock
|
164
178
|
- spec/spec_helper.rb
|
165
|
-
has_rdoc:
|