switchman 3.1.2 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb62453808b659106e48a2279bdabeb2901c97187eaf8ae6cd612d460096f6d0
4
- data.tar.gz: 5cf42b899e7a63f73bf5604247a8e2b2cd4a998bd7f4f0986180e451e66d3cc0
3
+ metadata.gz: 54ae135ce532aa5578592027f6ce46cf3aedecdf0a6fd097ae3597752f436bae
4
+ data.tar.gz: 02d88f28e64e487c6841940a383afd92a56378ea7c2e4b1156252c0bcf0fa71f
5
5
  SHA512:
6
- metadata.gz: 69d3bb8a559d81a5cb5ef81c7c19395c3eab13a9a53a0bd920ea715b822cde6256a2464f317a6f719c04c8f9baf99b751b6abb07ae6edda40055cd53b32c5a30
7
- data.tar.gz: e16d69bb4d2ec76fbe198a8d0d68e4217f3b2a261eff1fcde61b82357374f5c1b029e28f9ec852c090196461d2f45d162bc0c420182ccf0d3b7a4869f4ff5263
6
+ metadata.gz: 383075584faafb39abc64be4f6e77a99c4ca3dfd5acc1c57bae885ba71c8d13ce2cb0f89d9332fd8387f5100886a5a0ffbb6f6d53e382b0e54412aea6b72cf06
7
+ data.tar.gz: 875421e2c515a671ed8503fd07b55d22e16f098ddde635b5530a3ab4801c9bebd06a5e4e75d7a547b1e84e5628288dac9aefc0c6f9a23cedad80b1f8389bb5de
@@ -22,16 +22,20 @@ module Switchman
22
22
  @integral_id
23
23
  end
24
24
 
25
- def transaction(**)
26
- if self != ::ActiveRecord::Base && current_scope
27
- current_scope.activate do
28
- db = Shard.current(connection_class_for_self).database_server
29
- db.unguard { super }
25
+ %w[transaction insert_all upsert_all].each do |method|
26
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
27
+ def #{method}(*, **)
28
+ if self != ::ActiveRecord::Base && current_scope
29
+ current_scope.activate do
30
+ db = Shard.current(connection_class_for_self).database_server
31
+ db.unguard { super }
32
+ end
33
+ else
34
+ db = Shard.current(connection_class_for_self).database_server
35
+ db.unguard { super }
36
+ end
30
37
  end
31
- else
32
- db = Shard.current(connection_class_for_self).database_server
33
- db.unguard { super }
34
- end
38
+ RUBY
35
39
  end
36
40
 
37
41
  def reset_column_information
@@ -138,7 +142,7 @@ module Switchman
138
142
  else
139
143
  Shard.current(self.class.connection_class_for_self)
140
144
  end
141
- readonly! if shadow_record?
145
+ readonly! if shadow_record? && !Switchman.config[:writable_shadow_records]
142
146
  super
143
147
  end
144
148
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Switchman
4
- VERSION = '3.1.2'
4
+ VERSION = '3.1.3'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switchman
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.2
4
+ version: 3.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-07-19 00:00:00.000000000 Z
13
+ date: 2022-08-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord