effective_resources 1.8.24 → 1.8.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ef5eba619e3764fdc204b3e1b72ec0063b16c2319866688f4c8e7ff3808354d
4
- data.tar.gz: '09e02f90c4db8a1f0f416ec6ece7471db4e9ab865a4bac701a4977c9c6f4e18a'
3
+ metadata.gz: f3c3734459a525f8630d12e30d9e96b1e5c83e9d35cd94abecf6dcd791da2db1
4
+ data.tar.gz: 3c5d96f0b62dac483b987f16b97e7d9a003105ec28a1b09a6c556e77d379bae0
5
5
  SHA512:
6
- metadata.gz: 65b2ec2e37dd19c24375b02533b86519733d83652b24fc131f267d625de17bdd0210efea61ca84e7186e2b3b0d5821a94e7faf1805665bf752c0b2636456eb8f
7
- data.tar.gz: 8bf7c81fd895011224ffa0ed49942bf3c8517ca7e7a2c8141820247c859014de9fa1eed17517b25ed5951bff7d904c091b165d4ab1f2710ad8e674c34d9a8d06
6
+ metadata.gz: fcc4eb1793ace16a2f70c59fccba103f3398721eb6784dbb55d182e2320f131d11a2fae15a6a621e2ec7aa1fbe2f98074bdd66ff652fed943e835271a83cf611
7
+ data.tar.gz: 5eb1dded2b45631cd646bfda6a75d5d3cbcbf89e35f8d817d28aad950ba6e84274d30627b963e276392926bd337aec687f917a435aa11f9fc313d19395c6f6c2
@@ -1,5 +1,6 @@
1
1
  # EffectiveAfterCommit
2
2
  #
3
+ # Execute code after the ActiveRecord transaction has committed
3
4
  # Inspired by https://github.com/Envek/after_commit_everywhere
4
5
  #
5
6
  # This is automatically included into ActiveRecord::Base
@@ -16,7 +17,6 @@ module EffectiveAfterCommit
16
17
 
17
18
  def before_commit(connection: self.class.connection, &callback)
18
19
  raise(NotImplementedError, "#{__method__} works only with Rails 5.0+") if ActiveRecord::VERSION::MAJOR < 5
19
-
20
20
  Effective::AfterCommit.register_callback(connection: connection, name: __method__, callback: callback, no_tx_action: :warn_and_execute)
21
21
  end
22
22
 
@@ -1,8 +1,7 @@
1
1
  module Effective
2
2
  class AfterCommit
3
3
 
4
- def initialize(connection:, **handlers)
5
- @connection = connection
4
+ def initialize(**handlers)
6
5
  @handlers = handlers
7
6
  end
8
7
 
@@ -26,10 +25,6 @@ module Effective
26
25
  @handlers[:after_rollback]&.call
27
26
  end
28
27
 
29
- def add_to_transaction(*)
30
- @connection.add_transaction_record(self)
31
- end
32
-
33
28
  def self.register_callback(connection:, name:, no_tx_action:, callback:)
34
29
  raise ArgumentError, "#{name} expected a block" unless callback
35
30
 
@@ -45,7 +40,7 @@ module Effective
45
40
  end
46
41
  end
47
42
 
48
- after_commit = Effective::AfterCommit.new(connection: connection, "#{name}": callback)
43
+ after_commit = Effective::AfterCommit.new("#{name}": callback)
49
44
  connection.add_transaction_record(after_commit)
50
45
  end
51
46
 
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '1.8.24'.freeze
2
+ VERSION = '1.8.25'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.24
4
+ version: 1.8.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect