multi_client 2.1.0 → 2.2.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 +4 -4
- data/app/models/multi_client/client.rb +17 -3
- data/lib/generators/multi_client/install/install_generator.rb +1 -1
- data/lib/generators/multi_client/install/templates/{multi_client.rb → initializer.rb} +7 -0
- data/lib/multi_client/configuration.rb +2 -0
- data/lib/multi_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed95e6005b1c1325ace3a288f25b33d5e9a64b35
|
4
|
+
data.tar.gz: 9f780c279a89b8daea900809be1b648b9c9b3eb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b2c03c72d08b4528f5bc7ae16cc9905626977ea7a72bc50491d35874d57acf92f42f37ad27edd91262b61ee54acc0482d4227ce23bdab5f317d0a1d4edd5330
|
7
|
+
data.tar.gz: 7d08a4a58cec028212220ab4b4f845bec886a379acb4d9c6e0499802342524f85f7ee79cc78d2e2daa2603985acf62deb41652a471ff1fc99b0ea4c1eb3b7b81
|
@@ -34,9 +34,23 @@ module MultiClient
|
|
34
34
|
|
35
35
|
def self.with_tenant(tenant, &block)
|
36
36
|
original_id = current_id
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
begin
|
38
|
+
self.current_id = tenant.id
|
39
|
+
block.call
|
40
|
+
rescue
|
41
|
+
raise
|
42
|
+
ensure
|
43
|
+
self.current_id = original_id
|
44
|
+
end
|
40
45
|
end
|
46
|
+
|
47
|
+
def self.master?
|
48
|
+
!!(current && current.identifier == Configuration.master_tenant_identifier)
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.set_current_to_master
|
52
|
+
set_current_by_identifier(Configuration.master_tenant_identifier)
|
53
|
+
end
|
54
|
+
|
41
55
|
end
|
42
56
|
end
|
@@ -60,4 +60,11 @@ MultiClient.configure do |config|
|
|
60
60
|
# Default: config.no_subdomain_prefixes = ->(request) { ['www', '', nil] }
|
61
61
|
#
|
62
62
|
config.no_subdomain_prefixes = ->(request) { ['www', '', nil] }
|
63
|
+
|
64
|
+
# The master tenant is a special tenant. You can ask Tenant.master? to
|
65
|
+
# check, if the actual tenant is the master tenant.
|
66
|
+
#
|
67
|
+
# Default: config.master_tenant_identifier = '000'
|
68
|
+
#
|
69
|
+
config.master_tenant_identifier = '000'
|
63
70
|
end
|
data/lib/multi_client/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multi_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
@@ -150,7 +150,7 @@ files:
|
|
150
150
|
- config/routes.rb
|
151
151
|
- db/migrate/001_create_multi_client_clients.rb
|
152
152
|
- lib/generators/multi_client/install/install_generator.rb
|
153
|
-
- lib/generators/multi_client/install/templates/
|
153
|
+
- lib/generators/multi_client/install/templates/initializer.rb
|
154
154
|
- lib/multi_client.rb
|
155
155
|
- lib/multi_client/configuration.rb
|
156
156
|
- lib/multi_client/engine.rb
|