rails_multisite 4.0.0 → 5.0.0

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: c629d2dc8da503bfa856a639b4462108d15f776554dca35dd2d02545bc0e2793
4
- data.tar.gz: a8199f54a9af9b8fea60e9c772d845944925499067d3ce29d362ab4ad68f13fe
3
+ metadata.gz: add7672e986dbdd0ce0f0218a8fa8bdc47bc2d3fcf249713815168d1948bcb7d
4
+ data.tar.gz: ab260853b44b22769750544cf1074be4e395eb9970e06355c6379c84a790782d
5
5
  SHA512:
6
- metadata.gz: 14ea81350cad5b028a1d6558525d350b1dac376168249cb2fdcce148055fe7b86a53b3e4472815567f626025420dfd40156b84a0f6eb80ff714725df3a20d4bc
7
- data.tar.gz: b68b07d983452e6b1d785f6e927450cfe761983123408fcc0e7cb4589c4be2d4855a0351964ce497a278c17c5ffcc378a57bbfb55bfdf8a4059466f438d03646
6
+ metadata.gz: 59870af95574bfac059ed5f51778d2dea7e88824471e00be8fdb3fbe67e6ffded38432aa1c1c45daf4c92c8420c675b2bbe283ffd740a76acef4ce0ee6dab801
7
+ data.tar.gz: abfeb349711a8bdb66195ada55f7d441ced7da0fc1d4fe6b702a45d7d24a1b55e5a2f1a834cff708870caeb183acf84c9ac3544d1f1382cd6283a272b7fa5270
@@ -10,6 +10,8 @@ module RailsMultisite
10
10
  class ConnectionManagement
11
11
  DEFAULT = 'default'
12
12
 
13
+ cattr_accessor :connection_handlers, default: {}
14
+
13
15
  def self.default_config_filename
14
16
  File.absolute_path(Rails.root.to_s + "/config/multisite.yml")
15
17
  end
@@ -134,7 +136,9 @@ module RailsMultisite
134
136
 
135
137
  def self.handler_key(spec)
136
138
  @handler_key_suffix ||= begin
137
- if ActiveRecord::Base.respond_to?(:writing_role)
139
+ if ActiveRecord.respond_to?(:writing_role)
140
+ "_#{ActiveRecord.writing_role}"
141
+ elsif ActiveRecord::Base.respond_to?(:writing_role)
138
142
  "_#{ActiveRecord::Base.writing_role}"
139
143
  else
140
144
  ""
@@ -154,20 +158,12 @@ module RailsMultisite
154
158
  end
155
159
  end
156
160
 
157
- attr_reader :config_filename, :db_spec_cache, :connection_handlers
161
+ attr_reader :config_filename, :db_spec_cache
158
162
  attr_writer :default_connection_handler
159
163
 
160
164
  def initialize(config_filename)
161
165
  @config_filename = config_filename
162
166
 
163
- @connection_handlers = begin
164
- if ActiveRecord::Base.respond_to?(:connection_handlers)
165
- ActiveRecord::Base.connection_handlers
166
- else
167
- {}
168
- end
169
- end
170
-
171
167
  @db_spec_cache = {}
172
168
  @default_spec = ConnectionSpecification.default
173
169
  @default_connection_handler = ActiveRecord::Base.connection_handler
@@ -178,7 +174,7 @@ module RailsMultisite
178
174
  end
179
175
 
180
176
  def load_config!
181
- configs = YAML::load(File.open(@config_filename))
177
+ configs = YAML.safe_load(File.open(@config_filename))
182
178
 
183
179
  no_prepared_statements = @default_spec.config[:prepared_statements] == false
184
180
 
@@ -218,7 +214,7 @@ module RailsMultisite
218
214
  @db_spec_cache = new_db_spec_cache
219
215
 
220
216
  # Clean up connection handler cache.
221
- removed_specs.each { |s| @connection_handlers.delete(handler_key(s)) }
217
+ removed_specs.each { |s| connection_handlers.delete(handler_key(s)) }
222
218
  end
223
219
 
224
220
  def reload
@@ -246,11 +242,11 @@ module RailsMultisite
246
242
  spec ||= @default_spec
247
243
  handler = nil
248
244
  if spec != @default_spec
249
- handler = @connection_handlers[handler_key(spec)]
245
+ handler = connection_handlers[handler_key(spec)]
250
246
  unless handler
251
247
  handler = ActiveRecord::ConnectionAdapters::ConnectionHandler.new
252
248
  handler_establish_connection(handler, spec)
253
- @connection_handlers[handler_key(spec)] = handler
249
+ connection_handlers[handler_key(spec)] = handler
254
250
  end
255
251
  else
256
252
  handler = @default_connection_handler
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
3
  module RailsMultisite
4
- VERSION = "4.0.0"
4
+ VERSION = "5.0.0"
5
5
  end
metadata CHANGED
@@ -1,55 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_multisite
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-15 00:00:00.000000000 Z
11
+ date: 2023-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '7'
19
+ version: '6.0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">"
28
- - !ruby/object:Gem::Version
29
- version: '5.0'
30
- - - "<"
24
+ - - ">="
31
25
  - !ruby/object:Gem::Version
32
- version: '7'
26
+ version: '6.0'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: railties
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - ">"
31
+ - - ">="
38
32
  - !ruby/object:Gem::Version
39
- version: '5.0'
40
- - - "<"
41
- - !ruby/object:Gem::Version
42
- version: '7'
33
+ version: '6.0'
43
34
  type: :runtime
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
46
37
  requirements:
47
- - - ">"
48
- - !ruby/object:Gem::Version
49
- version: '5.0'
50
- - - "<"
38
+ - - ">="
51
39
  - !ruby/object:Gem::Version
52
- version: '7'
40
+ version: '6.0'
53
41
  description: Multi tenancy support for Rails
54
42
  email:
55
43
  - sam.saffron@gmail.com
@@ -73,7 +61,7 @@ files:
73
61
  homepage: ''
74
62
  licenses: []
75
63
  metadata: {}
76
- post_install_message:
64
+ post_install_message:
77
65
  rdoc_options: []
78
66
  require_paths:
79
67
  - lib
@@ -81,15 +69,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
69
  requirements:
82
70
  - - ">="
83
71
  - !ruby/object:Gem::Version
84
- version: 2.4.0
72
+ version: 3.0.0
85
73
  required_rubygems_version: !ruby/object:Gem::Requirement
86
74
  requirements:
87
75
  - - ">="
88
76
  - !ruby/object:Gem::Version
89
77
  version: '0'
90
78
  requirements: []
91
- rubygems_version: 3.1.6
92
- signing_key:
79
+ rubygems_version: 3.4.10
80
+ signing_key:
93
81
  specification_version: 4
94
82
  summary: Multi tenancy support for Rails
95
83
  test_files: []