after_commit_everywhere 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +0 -3
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +85 -86
- data/README.md +40 -0
- data/after_commit_everywhere.gemspec +1 -0
- data/gemfiles/activerecord_master.gemfile +0 -1
- data/lib/after_commit_everywhere.rb +59 -54
- data/lib/after_commit_everywhere/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4425b11aa2651bd44ec24dc839e1338537f087f89c3f19f250d3ad2aeb0fad07
|
4
|
+
data.tar.gz: 143406ceecd3d9d3e1f7999f8cbb3754c19186036a7b2f47f19996c932048e26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdaa287369af57e90b69699fdbd11b687491ea9c938af714e8a68871954b3685e07c4a9ba16939094ea6f082cec84ce351c9354341685f42bcd58bcc0307ee29
|
7
|
+
data.tar.gz: 5a42c24b63cbdf2d84597e3fa6071d588a76e8821736239a146708dd155a8492dc657c29577022d7072c13ecdcc4d0b1ee22243701d1e1058ebcd13ee6072573
|
data/Appraisals
CHANGED
@@ -39,7 +39,4 @@ appraise "activerecord-master" do
|
|
39
39
|
|
40
40
|
gem "sqlite3", "~> 1.4"
|
41
41
|
gem "rspec-rails", "~> 4.0"
|
42
|
-
|
43
|
-
# See https://github.com/cgriego/active_attr/pull/183
|
44
|
-
gem "active_attr", git: "https://github.com/Envek/active_attr.git", branch: "chore/loose-dependency-constraint"
|
45
42
|
end
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## 1.1.0 (2021-08-05)
|
10
|
+
|
11
|
+
### Added
|
12
|
+
|
13
|
+
- Allow to call transactional callbacks directly on `AfterCommitEverywhere` module:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
AfterCommitEverywhere.after_commit { puts "If you see me then transaction has been successfully commited!" }
|
17
|
+
```
|
18
|
+
|
19
|
+
- Allow to call `in_transaction?` helper method from instance methods in classes that includes `AfterCommitEverywhere` module.
|
20
|
+
|
9
21
|
## 1.0.0 (2021-02-17)
|
10
22
|
|
11
23
|
Declare gem as stable. No changes since 0.1.5.
|
data/Gemfile.lock
CHANGED
@@ -1,70 +1,71 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
after_commit_everywhere (0.
|
4
|
+
after_commit_everywhere (1.0.0)
|
5
5
|
activerecord (>= 4.2)
|
6
|
+
activesupport
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
|
-
actioncable (6.1.
|
11
|
-
actionpack (= 6.1.
|
12
|
-
activesupport (= 6.1.
|
11
|
+
actioncable (6.1.4)
|
12
|
+
actionpack (= 6.1.4)
|
13
|
+
activesupport (= 6.1.4)
|
13
14
|
nio4r (~> 2.0)
|
14
15
|
websocket-driver (>= 0.6.1)
|
15
|
-
actionmailbox (6.1.
|
16
|
-
actionpack (= 6.1.
|
17
|
-
activejob (= 6.1.
|
18
|
-
activerecord (= 6.1.
|
19
|
-
activestorage (= 6.1.
|
20
|
-
activesupport (= 6.1.
|
16
|
+
actionmailbox (6.1.4)
|
17
|
+
actionpack (= 6.1.4)
|
18
|
+
activejob (= 6.1.4)
|
19
|
+
activerecord (= 6.1.4)
|
20
|
+
activestorage (= 6.1.4)
|
21
|
+
activesupport (= 6.1.4)
|
21
22
|
mail (>= 2.7.1)
|
22
|
-
actionmailer (6.1.
|
23
|
-
actionpack (= 6.1.
|
24
|
-
actionview (= 6.1.
|
25
|
-
activejob (= 6.1.
|
26
|
-
activesupport (= 6.1.
|
23
|
+
actionmailer (6.1.4)
|
24
|
+
actionpack (= 6.1.4)
|
25
|
+
actionview (= 6.1.4)
|
26
|
+
activejob (= 6.1.4)
|
27
|
+
activesupport (= 6.1.4)
|
27
28
|
mail (~> 2.5, >= 2.5.4)
|
28
29
|
rails-dom-testing (~> 2.0)
|
29
|
-
actionpack (6.1.
|
30
|
-
actionview (= 6.1.
|
31
|
-
activesupport (= 6.1.
|
30
|
+
actionpack (6.1.4)
|
31
|
+
actionview (= 6.1.4)
|
32
|
+
activesupport (= 6.1.4)
|
32
33
|
rack (~> 2.0, >= 2.0.9)
|
33
34
|
rack-test (>= 0.6.3)
|
34
35
|
rails-dom-testing (~> 2.0)
|
35
36
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
36
|
-
actiontext (6.1.
|
37
|
-
actionpack (= 6.1.
|
38
|
-
activerecord (= 6.1.
|
39
|
-
activestorage (= 6.1.
|
40
|
-
activesupport (= 6.1.
|
37
|
+
actiontext (6.1.4)
|
38
|
+
actionpack (= 6.1.4)
|
39
|
+
activerecord (= 6.1.4)
|
40
|
+
activestorage (= 6.1.4)
|
41
|
+
activesupport (= 6.1.4)
|
41
42
|
nokogiri (>= 1.8.5)
|
42
|
-
actionview (6.1.
|
43
|
-
activesupport (= 6.1.
|
43
|
+
actionview (6.1.4)
|
44
|
+
activesupport (= 6.1.4)
|
44
45
|
builder (~> 3.1)
|
45
46
|
erubi (~> 1.4)
|
46
47
|
rails-dom-testing (~> 2.0)
|
47
48
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
48
|
-
active_attr (0.15.
|
49
|
-
actionpack (>= 3.0.2, <
|
50
|
-
activemodel (>= 3.0.2, <
|
51
|
-
activesupport (>= 3.0.2, <
|
52
|
-
activejob (6.1.
|
53
|
-
activesupport (= 6.1.
|
49
|
+
active_attr (0.15.3)
|
50
|
+
actionpack (>= 3.0.2, < 7.0)
|
51
|
+
activemodel (>= 3.0.2, < 7.0)
|
52
|
+
activesupport (>= 3.0.2, < 7.0)
|
53
|
+
activejob (6.1.4)
|
54
|
+
activesupport (= 6.1.4)
|
54
55
|
globalid (>= 0.3.6)
|
55
|
-
activemodel (6.1.
|
56
|
-
activesupport (= 6.1.
|
57
|
-
activerecord (6.1.
|
58
|
-
activemodel (= 6.1.
|
59
|
-
activesupport (= 6.1.
|
60
|
-
activestorage (6.1.
|
61
|
-
actionpack (= 6.1.
|
62
|
-
activejob (= 6.1.
|
63
|
-
activerecord (= 6.1.
|
64
|
-
activesupport (= 6.1.
|
65
|
-
marcel (~> 0.
|
66
|
-
|
67
|
-
activesupport (6.1.
|
56
|
+
activemodel (6.1.4)
|
57
|
+
activesupport (= 6.1.4)
|
58
|
+
activerecord (6.1.4)
|
59
|
+
activemodel (= 6.1.4)
|
60
|
+
activesupport (= 6.1.4)
|
61
|
+
activestorage (6.1.4)
|
62
|
+
actionpack (= 6.1.4)
|
63
|
+
activejob (= 6.1.4)
|
64
|
+
activerecord (= 6.1.4)
|
65
|
+
activesupport (= 6.1.4)
|
66
|
+
marcel (~> 1.0.0)
|
67
|
+
mini_mime (>= 1.1.0)
|
68
|
+
activesupport (6.1.4)
|
68
69
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
69
70
|
i18n (>= 1.6, < 2)
|
70
71
|
minitest (>= 5.1)
|
@@ -72,79 +73,77 @@ GEM
|
|
72
73
|
zeitwerk (~> 2.3)
|
73
74
|
anyway_config (2.1.0)
|
74
75
|
ruby-next-core (>= 0.11.0)
|
75
|
-
appraisal (2.
|
76
|
+
appraisal (2.4.1)
|
76
77
|
bundler
|
77
78
|
rake
|
78
79
|
thor (>= 0.14.0)
|
79
80
|
ast (2.4.2)
|
80
81
|
builder (3.2.4)
|
81
82
|
coderay (1.1.3)
|
82
|
-
concurrent-ruby (1.1.
|
83
|
+
concurrent-ruby (1.1.9)
|
83
84
|
crass (1.0.6)
|
84
85
|
diff-lcs (1.4.4)
|
85
86
|
erubi (1.10.0)
|
86
|
-
globalid (0.
|
87
|
-
activesupport (>=
|
88
|
-
i18n (1.8.
|
87
|
+
globalid (0.5.2)
|
88
|
+
activesupport (>= 5.0)
|
89
|
+
i18n (1.8.10)
|
89
90
|
concurrent-ruby (~> 1.0)
|
90
91
|
isolator (0.7.0)
|
91
92
|
sniffer (>= 0.3.1)
|
92
93
|
jaro_winkler (1.5.4)
|
93
|
-
loofah (2.
|
94
|
+
loofah (2.11.0)
|
94
95
|
crass (~> 1.0.2)
|
95
96
|
nokogiri (>= 1.5.9)
|
96
97
|
mail (2.7.1)
|
97
98
|
mini_mime (>= 0.1.1)
|
98
|
-
marcel (0.
|
99
|
-
mimemagic (~> 0.3.2)
|
99
|
+
marcel (1.0.1)
|
100
100
|
method_source (1.0.0)
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
mini_portile2 (~> 2.5.0)
|
101
|
+
mini_mime (1.1.0)
|
102
|
+
mini_portile2 (2.6.1)
|
103
|
+
minitest (5.14.4)
|
104
|
+
nio4r (2.5.8)
|
105
|
+
nokogiri (1.12.2)
|
106
|
+
mini_portile2 (~> 2.6.1)
|
108
107
|
racc (~> 1.4)
|
109
108
|
parallel (1.20.1)
|
110
|
-
parser (3.0.
|
109
|
+
parser (3.0.2.0)
|
111
110
|
ast (~> 2.4.1)
|
112
|
-
pry (0.14.
|
111
|
+
pry (0.14.1)
|
113
112
|
coderay (~> 1.1)
|
114
113
|
method_source (~> 1.0)
|
115
114
|
racc (1.5.2)
|
116
115
|
rack (2.2.3)
|
117
116
|
rack-test (1.1.0)
|
118
117
|
rack (>= 1.0, < 3)
|
119
|
-
rails (6.1.
|
120
|
-
actioncable (= 6.1.
|
121
|
-
actionmailbox (= 6.1.
|
122
|
-
actionmailer (= 6.1.
|
123
|
-
actionpack (= 6.1.
|
124
|
-
actiontext (= 6.1.
|
125
|
-
actionview (= 6.1.
|
126
|
-
activejob (= 6.1.
|
127
|
-
activemodel (= 6.1.
|
128
|
-
activerecord (= 6.1.
|
129
|
-
activestorage (= 6.1.
|
130
|
-
activesupport (= 6.1.
|
118
|
+
rails (6.1.4)
|
119
|
+
actioncable (= 6.1.4)
|
120
|
+
actionmailbox (= 6.1.4)
|
121
|
+
actionmailer (= 6.1.4)
|
122
|
+
actionpack (= 6.1.4)
|
123
|
+
actiontext (= 6.1.4)
|
124
|
+
actionview (= 6.1.4)
|
125
|
+
activejob (= 6.1.4)
|
126
|
+
activemodel (= 6.1.4)
|
127
|
+
activerecord (= 6.1.4)
|
128
|
+
activestorage (= 6.1.4)
|
129
|
+
activesupport (= 6.1.4)
|
131
130
|
bundler (>= 1.15.0)
|
132
|
-
railties (= 6.1.
|
131
|
+
railties (= 6.1.4)
|
133
132
|
sprockets-rails (>= 2.0.0)
|
134
133
|
rails-dom-testing (2.0.3)
|
135
134
|
activesupport (>= 4.2.0)
|
136
135
|
nokogiri (>= 1.6)
|
137
136
|
rails-html-sanitizer (1.3.0)
|
138
137
|
loofah (~> 2.3)
|
139
|
-
railties (6.1.
|
140
|
-
actionpack (= 6.1.
|
141
|
-
activesupport (= 6.1.
|
138
|
+
railties (6.1.4)
|
139
|
+
actionpack (= 6.1.4)
|
140
|
+
activesupport (= 6.1.4)
|
142
141
|
method_source
|
143
|
-
rake (>= 0.
|
142
|
+
rake (>= 0.13)
|
144
143
|
thor (~> 1.0)
|
145
144
|
rainbow (3.0.0)
|
146
|
-
rake (13.0.
|
147
|
-
rexml (3.2.
|
145
|
+
rake (13.0.6)
|
146
|
+
rexml (3.2.5)
|
148
147
|
rspec (3.10.0)
|
149
148
|
rspec-core (~> 3.10.0)
|
150
149
|
rspec-expectations (~> 3.10.0)
|
@@ -157,10 +156,10 @@ GEM
|
|
157
156
|
rspec-mocks (3.10.2)
|
158
157
|
diff-lcs (>= 1.2.0, < 2.0)
|
159
158
|
rspec-support (~> 3.10.0)
|
160
|
-
rspec-rails (
|
161
|
-
actionpack (>=
|
162
|
-
activesupport (>=
|
163
|
-
railties (>=
|
159
|
+
rspec-rails (5.0.1)
|
160
|
+
actionpack (>= 5.2)
|
161
|
+
activesupport (>= 5.2)
|
162
|
+
railties (>= 5.2)
|
164
163
|
rspec-core (~> 3.10)
|
165
164
|
rspec-expectations (~> 3.10)
|
166
165
|
rspec-mocks (~> 3.10)
|
@@ -191,7 +190,7 @@ GEM
|
|
191
190
|
tzinfo (2.0.4)
|
192
191
|
concurrent-ruby (~> 1.0)
|
193
192
|
unicode-display_width (1.7.0)
|
194
|
-
websocket-driver (0.7.
|
193
|
+
websocket-driver (0.7.5)
|
195
194
|
websocket-extensions (>= 0.1.0)
|
196
195
|
websocket-extensions (0.1.5)
|
197
196
|
zeitwerk (2.4.2)
|
@@ -213,4 +212,4 @@ DEPENDENCIES
|
|
213
212
|
sqlite3 (~> 1.3, >= 1.3.6)
|
214
213
|
|
215
214
|
BUNDLED WITH
|
216
|
-
2.2.
|
215
|
+
2.2.25
|
data/README.md
CHANGED
@@ -55,6 +55,12 @@ ActiveRecord::Base.transaction do
|
|
55
55
|
end
|
56
56
|
```
|
57
57
|
|
58
|
+
Or call it directly on module:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
AfterCommitEverywhere.after_commit { puts "We're all done!" }
|
62
|
+
```
|
63
|
+
|
58
64
|
That's it!
|
59
65
|
|
60
66
|
But the main benefit is that it works with nested `transaction` blocks (may be even spread across many files in your codebase):
|
@@ -107,6 +113,12 @@ If called outside transaction will raise an exception!
|
|
107
113
|
|
108
114
|
Please keep in mind ActiveRecord's [limitations for rolling back nested transactions](http://api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html#module-ActiveRecord::Transactions::ClassMethods-label-Nested+transactions).
|
109
115
|
|
116
|
+
### Available helper methods
|
117
|
+
|
118
|
+
#### `in_transaction?`
|
119
|
+
|
120
|
+
Returns `true` when called inside open transaction, `false` otherwise.
|
121
|
+
|
110
122
|
### FAQ
|
111
123
|
|
112
124
|
#### Does it works with transactional_test or DatabaseCleaner
|
@@ -133,6 +145,34 @@ By calling [the class level `after_commit` method on models](https://api.rubyonr
|
|
133
145
|
|
134
146
|
See https://github.com/Envek/after_commit_everywhere/issues/13 for details.
|
135
147
|
|
148
|
+
#### But what if I want to use it inside models anyway?
|
149
|
+
|
150
|
+
In class-level methods call `AfterCommitEverywhere.after_commit` directly:
|
151
|
+
|
152
|
+
```ruby
|
153
|
+
class Post < ActiveRecord::Base
|
154
|
+
def self.bulk_ops
|
155
|
+
find_each do
|
156
|
+
AfterCommitEverywhere.after_commit { puts "Now it works as expected!" }
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
```
|
161
|
+
|
162
|
+
For usage in instance-level methods include this module to your model class (or right into your `ApplicationRecord`):
|
163
|
+
|
164
|
+
```ruby
|
165
|
+
class Post < ActiveRecord::Base
|
166
|
+
include AfterCommitEverywhere
|
167
|
+
|
168
|
+
def do_some_stuff
|
169
|
+
after_commit { puts "Now it works!" }
|
170
|
+
end
|
171
|
+
end
|
172
|
+
```
|
173
|
+
|
174
|
+
However, if you do something in models that requires defining such ad-hoc transactional callbacks, it may indicate that your models have too many responsibilities and these methods should be extracted to separate secialized layers (service objects, etc).
|
175
|
+
|
136
176
|
## Development
|
137
177
|
|
138
178
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.require_paths = ["lib"]
|
30
30
|
|
31
31
|
spec.add_dependency "activerecord", ">= 4.2"
|
32
|
+
spec.add_dependency "activesupport"
|
32
33
|
spec.add_development_dependency "appraisal"
|
33
34
|
spec.add_development_dependency "bundler", "~> 2.0"
|
34
35
|
spec.add_development_dependency "isolator", "~> 0.7"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "active_record"
|
4
|
+
require "active_support/core_ext/module/delegation"
|
4
5
|
|
5
6
|
require "after_commit_everywhere/version"
|
6
7
|
require "after_commit_everywhere/wrap"
|
@@ -12,65 +13,69 @@ require "after_commit_everywhere/wrap"
|
|
12
13
|
module AfterCommitEverywhere
|
13
14
|
class NotInTransaction < RuntimeError; end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
#
|
18
|
-
# If called outside transaction it will execute callback immediately.
|
19
|
-
#
|
20
|
-
# @param connection [ActiveRecord::ConnectionAdapters::AbstractAdapter]
|
21
|
-
# @param callback [#call] Callback to be executed
|
22
|
-
# @return void
|
23
|
-
def after_commit(connection: ActiveRecord::Base.connection, &callback)
|
24
|
-
AfterCommitEverywhere.register_callback(
|
25
|
-
connection: connection,
|
26
|
-
name: __method__,
|
27
|
-
callback: callback,
|
28
|
-
no_tx_action: :execute,
|
29
|
-
)
|
30
|
-
end
|
16
|
+
delegate :after_commit, :before_commit, :after_rollback, to: AfterCommitEverywhere
|
17
|
+
delegate :in_transaction?, to: AfterCommitEverywhere
|
31
18
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
19
|
+
class << self
|
20
|
+
# Runs +callback+ after successful commit of outermost transaction for
|
21
|
+
# database +connection+.
|
22
|
+
#
|
23
|
+
# If called outside transaction it will execute callback immediately.
|
24
|
+
#
|
25
|
+
# @param connection [ActiveRecord::ConnectionAdapters::AbstractAdapter]
|
26
|
+
# @param callback [#call] Callback to be executed
|
27
|
+
# @return void
|
28
|
+
def after_commit(connection: ActiveRecord::Base.connection, &callback)
|
29
|
+
register_callback(
|
30
|
+
connection: connection,
|
31
|
+
name: __method__,
|
32
|
+
callback: callback,
|
33
|
+
no_tx_action: :execute,
|
34
|
+
)
|
44
35
|
end
|
45
36
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
37
|
+
# Runs +callback+ before committing of outermost transaction for +connection+.
|
38
|
+
#
|
39
|
+
# If called outside transaction it will execute callback immediately.
|
40
|
+
#
|
41
|
+
# Available only since Ruby on Rails 5.0. See https://github.com/rails/rails/pull/18936
|
42
|
+
#
|
43
|
+
# @param connection [ActiveRecord::ConnectionAdapters::AbstractAdapter]
|
44
|
+
# @param callback [#call] Callback to be executed
|
45
|
+
# @return void
|
46
|
+
def before_commit(connection: ActiveRecord::Base.connection, &callback)
|
47
|
+
if ActiveRecord::VERSION::MAJOR < 5
|
48
|
+
raise NotImplementedError, "#{__method__} works only with Rails 5.0+"
|
49
|
+
end
|
53
50
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
# @param callback [#call] Callback to be executed
|
62
|
-
# @return void
|
63
|
-
# @raise [NotInTransaction] if called outside transaction.
|
64
|
-
def after_rollback(connection: ActiveRecord::Base.connection, &callback)
|
65
|
-
AfterCommitEverywhere.register_callback(
|
66
|
-
connection: connection,
|
67
|
-
name: __method__,
|
68
|
-
callback: callback,
|
69
|
-
no_tx_action: :exception,
|
70
|
-
)
|
71
|
-
end
|
51
|
+
register_callback(
|
52
|
+
connection: connection,
|
53
|
+
name: __method__,
|
54
|
+
callback: callback,
|
55
|
+
no_tx_action: :warn_and_execute,
|
56
|
+
)
|
57
|
+
end
|
72
58
|
|
73
|
-
|
59
|
+
# Runs +callback+ after rolling back of transaction or savepoint (if declared
|
60
|
+
# in nested transaction) for database +connection+.
|
61
|
+
#
|
62
|
+
# Caveat: do not raise +ActivRecord::Rollback+ in nested transaction block!
|
63
|
+
# See http://api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html#module-ActiveRecord::Transactions::ClassMethods-label-Nested+transactions
|
64
|
+
#
|
65
|
+
# @param connection [ActiveRecord::ConnectionAdapters::AbstractAdapter]
|
66
|
+
# @param callback [#call] Callback to be executed
|
67
|
+
# @return void
|
68
|
+
# @raise [NotInTransaction] if called outside transaction.
|
69
|
+
def after_rollback(connection: ActiveRecord::Base.connection, &callback)
|
70
|
+
register_callback(
|
71
|
+
connection: connection,
|
72
|
+
name: __method__,
|
73
|
+
callback: callback,
|
74
|
+
no_tx_action: :exception,
|
75
|
+
)
|
76
|
+
end
|
77
|
+
|
78
|
+
# @api private
|
74
79
|
def register_callback(connection:, name:, no_tx_action:, callback:)
|
75
80
|
raise ArgumentError, "Provide callback to #{name}" unless callback
|
76
81
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: after_commit_everywhere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey Novikov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: appraisal
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -224,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
238
|
- !ruby/object:Gem::Version
|
225
239
|
version: '0'
|
226
240
|
requirements: []
|
227
|
-
rubygems_version: 3.1.
|
241
|
+
rubygems_version: 3.1.6
|
228
242
|
signing_key:
|
229
243
|
specification_version: 4
|
230
244
|
summary: Executes code after database commit wherever you want in your application
|