pg_rls 0.1.5 → 0.1.9

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: 96c51a563fc96608b2c952922f3f38475fe3dcd2a1822ee367a80b50997df72c
4
- data.tar.gz: 1540d7bdc72fa8a2ea31eeeeadcb22ad06c5efc80b54440edc3a4ecdd6af155c
3
+ metadata.gz: 9bc1212df6e6ab132c3772bf7b88e6ceac339f691ab826f6128c714c106d0012
4
+ data.tar.gz: bc232e7a0c941f8da38c0e58c3e9bb373651379e137c8c2cb45eb139ddda560a
5
5
  SHA512:
6
- metadata.gz: '082c4cad7586ccf9f1c5aef6047489c52b86d4bd1b1dc3de0c4b2d7afec357d9b2463cdf753987c52657067372f5ac4fe271b874fabd383156519b34bebfca2f'
7
- data.tar.gz: 9b46030589110529d4a2c6cd92590700cfd16fa139aa0e257431d43de19faf38f7d5e1bb8541c06253ec878dbbe4e9b92969cfcfa89df78bb47d0ba1cb206884
6
+ metadata.gz: 01bc710caa9f3917eba70423b9270ee564861af86f2efb544199a1ba126b521cecfb5601c47d72f223ec78ef26b6d1f3470d29be92bedf2b07550ceb94fd7a1c
7
+ data.tar.gz: f9e2589ac082c4024a7c4c7afe43b2454c0de0793ae2a6dfee45b1af1b63fb32ea0550b711b25938c5b032d039351cbcddb2baf0184d46f454f422b0ec27a88b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pg_rls (0.1.5)
4
+ pg_rls (0.1.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/lib/pg_rls/tenant.rb CHANGED
@@ -65,10 +65,6 @@ module PgRls
65
65
  private
66
66
 
67
67
  def switch_tenant!(resource)
68
- # rubocop: disable Rails/IgnoredColumnsAssignment
69
- PgRls.main_model.ignored_columns = []
70
- # rubocop: enable Rails/IgnoredColumnsAssignment
71
-
72
68
  tenant = find_tenant(resource)
73
69
 
74
70
  set_rls!(tenant.tenant_id)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRls
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.9'
5
5
  end
data/lib/pg_rls.rb CHANGED
@@ -32,8 +32,10 @@ module PgRls
32
32
 
33
33
  def setup
34
34
  ActiveRecord::Base.ignored_columns += %w[tenant_id]
35
-
36
35
  yield self
36
+ Rails.application.config.after_initialize do
37
+ PgRls.main_model.ignored_columns = []
38
+ end
37
39
  end
38
40
 
39
41
  def connection_class
@@ -50,7 +52,9 @@ module PgRls
50
52
  def establish_new_connection!(admin: false)
51
53
  self.as_db_admin = admin
52
54
 
55
+ db_config = PgRls.main_model.connection_db_config.configuration_hash
53
56
  execute_rls_in_shards do |connection_class, pool|
57
+ connection_class.connection_pool.disconnect!
54
58
  connection_class.remove_connection
55
59
  connection_class.establish_connection(pool.db_config)
56
60
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_rls
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Laloush
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-29 00:00:00.000000000 Z
11
+ date: 2024-06-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  This gem will help you to integrate PostgreSQL RLS to help you develop a great multitenancy application
@@ -71,7 +71,7 @@ licenses:
71
71
  - MIT
72
72
  metadata:
73
73
  rubygems_mfa_required: 'true'
74
- post_install_message:
74
+ post_install_message:
75
75
  rdoc_options: []
76
76
  require_paths:
77
77
  - lib
@@ -86,8 +86,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
88
  requirements: []
89
- rubygems_version: 3.4.21
90
- signing_key:
89
+ rubygems_version: 3.4.10
90
+ signing_key:
91
91
  specification_version: 4
92
92
  summary: Write a short summary, because RubyGems requires one.
93
93
  test_files: []