activerecord-tenanted 0.2.0 → 0.3.0

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: f8caa70e9efec8b621843583547b9c3b2849bbe6923789c68944bc3dd2de4da8
4
- data.tar.gz: 6c6e9bb4e6b7a879c8d6c9ad8e6ee441493aa5b06cbb35f0e3254481555cd3d9
3
+ metadata.gz: bec774f1cd8bd92dc8d4f0db6e76f310adbe19ccc5873e599ba0d2416f6a2dcc
4
+ data.tar.gz: bd914d09c8e8e0e5cef89523ac59b5152fd34154c7fc64f3cf6630713ae4bf82
5
5
  SHA512:
6
- metadata.gz: 48772fda086b35feb27532973e33d8284372af39bba95c0e69c8386ac8a8b893d4970d02fd1b47fe5fd76d5af948e845564885c3bcbf6c70ec3dc010952748d7
7
- data.tar.gz: 4b0b7cccadd0a5f2acd373b0b152d81c5a632b6ed4bfdf22371300fb5809fccc150202f87fc3b28c05afe50e1c35f3907fcd34b856406d1dff9077fca2d8e180
6
+ metadata.gz: 54f36d6835c976757988eba57325ffe7a62e5bf53fad44fa6db9a463c4bbb42b1adea362d7c35d605cdd5cc016b0bd0b28426108efb27644a9e1279d9f6ccb72
7
+ data.tar.gz: c430f00a857613851bac9c8e81f04ae794dd90d2827e88d914c231bac218daa352b5fc0a3c21fdb82e2073e46422ebf85c310950fe4972595f4616e03374fa04
@@ -137,6 +137,10 @@ module ActiveRecord
137
137
  end
138
138
  end
139
139
 
140
+ initializer "active_record_tenanted.action_dispatch", before: "action_dispatch.configure" do
141
+ config.action_dispatch.rescue_responses["ActiveRecord::Tenanted::TenantDoesNotExistError"] = :not_found
142
+ end
143
+
140
144
  config.after_initialize do
141
145
  if defined?(Rails::Console)
142
146
  require "rails/commands/console/irb_console"
@@ -16,6 +16,10 @@ module ActiveRecord
16
16
  tenant ? "#{super}?tenant=#{tenant}" : super
17
17
  end
18
18
 
19
+ def inspect
20
+ tenant ? super.sub(/>$/, ", tenant=#{tenant.inspect}>") : super
21
+ end
22
+
19
23
  def to_global_id(options = {})
20
24
  super(options.merge(tenant: tenant))
21
25
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "rack/contrib"
4
-
5
3
  module ActiveRecord
6
4
  module Tenanted
7
5
  #
@@ -34,8 +32,7 @@ module ActiveRecord
34
32
  elsif tenanted_class.tenant_exist?(tenant_name)
35
33
  tenanted_class.with_tenant(tenant_name) { @app.call(env) }
36
34
  else
37
- Rails.logger.info("ActiveRecord::Tenanted::TenantSelector: Tenant not found: #{tenant_name.inspect}")
38
- Rack::NotFound.new(Rails.root.join("public/404.html")).call(env)
35
+ raise ActiveRecord::Tenanted::TenantDoesNotExistError, "Tenant not found: #{tenant_name.inspect}"
39
36
  end
40
37
  end
41
38
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRecord
4
4
  module Tenanted
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-tenanted
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Dalessio
@@ -37,20 +37,6 @@ dependencies:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: 8.1.alpha
40
- - !ruby/object:Gem::Dependency
41
- name: rack-contrib
42
- requirement: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 2.5.0
47
- type: :runtime
48
- prerelease: false
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: 2.5.0
54
40
  - !ruby/object:Gem::Dependency
55
41
  name: zeitwerk
56
42
  requirement: !ruby/object:Gem::Requirement